This example inserts an index entry after the selection in the active document. The subentry text is the text from the selection.
If Selection.Type = wdSelectionNormal Then
ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
Entry:="Introduction:" & Selection.Range.Text, Italic:=True
End If
This example inserts a table of contents entry that references the selected text. The text typed in the input box appears in the table of contents. A table of contents that uses fields is then added at the beginning of the active document.
entryText = InputBox("Type entry text")
ActiveDocument.TablesOfContents.MarkEntry _
Range:=Selection.Range, Entry:=entryText
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.TablesOfContents.Add _
Range:=myRange, UseFields:=True, _
UseHeadingStyles:=False