Add related procedures in class AutoCorrectEntry (Word VBA)

This page presents procedures from class AutoCorrectEntry related to the theme Add: AutoCorrectEntries.Add and AutoCorrectEntries.AddRichText

AutoCorrectEntries.Add

Returns an AutoCorrectEntry object that represents a plain-text AutoCorrect entry added to the list of available AutoCorrect entries.

Use the AddRichText method to create a formatted AutoCorrect entry.

Syntax : expression.Add (Name, Value)

AutoCorrect.Entries.Add Name:="thier", Value:="their"

Arguments

The following arguments are required:

Name (String) - The text you want to have automatically replaced with the text specified by Value.

Value (String) - The text you want to have automatically inserted whenever the text specified by Name is typed.

AutoCorrectEntries.AddRichText

Creates a formatted AutoCorrect entry, preserving all text attributes of the specified range. Returns an AutoCorrectEntry object.

The RichText property for entries added by using this method returns True. If AddRichText isn't used, inserted AutoCorrect entries conform to the current style.

Syntax : expression.AddRichText (Name, Range)

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

Arguments

The following arguments are required:

Name (String) - The text to replace automatically with Range.

Range (Range) - The formatted text that Word will insert automatically whenever Name is typed.