Indexes Property Example

This example adds an index at the end of the active document.

Set MyRange = _
    ActiveDocument.Range(Start:=ActiveDocument.Content.End - 1, _
    End:=ActiveDocument.Content.End - 1)
ActiveDocument.Indexes.Add Range:=MyRange, NumberOfColumns:=1, _
    HeadingSeparator:=False

This example inserts an index entry for the selected text.

If Selection.Type = wdSelectionNormal Then
    ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
        Entry:=Selection.Range.Text
End If