TextBox Question RRS feed

  • Question

  • I have the following macro in a user form that creates a marker for when a TOC is created. My question is there a way to add the text thats in TextBox2 to my document without having to create a bookmark for it? This is how I would like it to look:

    1.0 { TC "1.0   Procedure" \f C\ I "2"}Procedure

    Here is my macro:

    ActiveWindow.ActPane.View.ShowAll = True

    ActiveDocument.TablesOfContents.MarkEntry Range:=Selection.Range, Entry:= _

        TextBox1 & vbTab & TextBox2, EntryAutoText:="", TableID:="C" _

        , Level:+2

    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft

    ActiveWindow.ActivePane.View.SeekView = wdSeeMainDocument


    TextBox1 = ""

    TextBox2 = ""

    Selection.EndKey Unit:=wdLine


    Thursday, May 24, 2012 8:46 PM


All replies

  • Hi fuzzhead

    Can you explain WHERE you want the text to appear?

    You can do this: Selection.Range.Text = TextBox2.Text

    The only question is whether this is where you want to see it...

    Cindy Meister, VSTO/Word MVP

    Friday, May 25, 2012 5:36 AM
  • I would like it to appear right after the marker for the TOC.

    Friday, May 25, 2012 2:02 PM
  • I just added the line after I create my marker and it worked. Thank you for your help.
    • Marked as answer by fuzzhead58 Friday, May 25, 2012 2:53 PM
    Friday, May 25, 2012 2:53 PM