Indexes.MarkEntry Method

Word Developer Reference

Inserts an XE (Index Entry) field after the specified range. The method returns a Field object representing the XE field.

Syntax

expression.MarkEntry(Range, Entry, EntryAutoText, CrossReference, CrossReferenceAutoText, BookmarkName, Bold, Italic, Reading)

expression   Required. A variable that represents an Indexes collection.

Parameters

Name Required/Optional Data Type Description
Range Required Range object The location of the entry. The XE field is inserted after Range.
Entry Optional Variant The text that appears in the index. To indicate a subentry, include the main entry text and the subentry text, separated by a colon (:) (for example, "Introduction:The Product").
EntryAutoText Optional Variant The AutoText entry name that includes text for the index, table of figures, or table of contents (Entry is ignored).
CrossReference Optional Variant A cross-reference that will appear in the index (for example, "See Apples").
CrossReferenceAutoText Optional Variant The AutoText entry name that contains the text for a cross-reference (CrossReference is ignored).
BookmarkName Optional Variant The name of the bookmark that marks the range of pages you want to appear in the index. If this argument is omitted, the number of the page containing the XE field appears in the index.
Bold Optional Variant True to add bold formatting to the entry page numbers in the index.
Italic Optional Variant True to add italic formatting to the entry page numbers in the index.
Reading Optional Variant True shows an index entry in the right location when indexes are sorted phonetically (East Asian languages only).

Return Value
Field

Example

This example inserts an index entry after the selection in the active document. The subentry text is the text from the selection.

Visual Basic for Applications
  If Selection.Type = wdSelectionNormal Then
    ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
        Entry:="Introduction:" & Selection.Range.Text, Italic:=True
End If

See Also