AddRichText Method Example

This example stores the selected text as a formatted AutoCorrect entry that will be inserted automatically whenever "NewText" is typed.

'checks for text selected
If Selection.Type = wdSelectionNormal Then
    AutoCorrect.Entries.AddRichText "NewText", Selection.Range
Else
    MsgBox "You need to select some text."
End If

This example stores the third word in the active document as a formatted AutoCorrect entry that will be inserted automatically whenever "NewText" is typed.

AutoCorrect.Entries.AddRichText "NewText", ActiveDocument.Words(3)