Indexes.MarkAllEntries (Word)

Inserts an XE (Index Entry) field after all instances of the text in Range.

Syntax : expression.MarkAllEntries (Range, Entry, EntryAutoText, CrossReference, CrossReferenceAutoText, BookmarkName, Bold, Italic)

If Selection.Type = wdSelectionNormal Then 
 ActiveDocument.Indexes.MarkAllEntries _ 
 Range:=Selection.Range, _ 
 Entry:=Selection.Range.Text, Italic:=True 
 ActiveDocument.Indexes(1).Update 
End If

Arguments

The following argument is required

Range (Range) - The range whose text is marked with an XE field throughout the document.

The following arguments are optional

Entry (Index) - The text you want to appear in the index, in the form MainEntry[:Subentry].

EntryAutoText (String) - The AutoText entry that contains the text you want to appear in the index (if this argument is specified, Entry is ignored).

CrossReference (Index) - A cross-reference that will appear in the index.

CrossReferenceAutoText (String) - The name of the AutoText entry that contains the text for a cross-reference (if this argument is specified, CrossReference is ignored).

BookmarkName (String) - The bookmark name that marks the range of pages you want to appear in the index. If this argument is omitted, the number of the page that contains the XE field appears in the index.

Bold (Boolean) - True to add bold formatting to page numbers for index entries.

Italic (Boolean) - True to add italic formatting to page numbers for index entries.