Class AutoCorrectEntry (Word VBA)

The class AutoCorrectEntry represents a single AutoCorrect entry. The AutoCorrectEntry object is a member of the AutoCorrectEntries collection. The AutoCorrectEntries collection includes the entries in the AutoCorrect dialog box.

To use a AutoCorrectEntry class variable it first needs to be instantiated, for example

Dim ace as AutoCorrectEntry
Set ace = AutoCorrect.Entries(Index:=1)

The following procedures can be used to set variables of type AutoCorrectEntry: AutoCorrectEntries.Add, AutoCorrectEntries.AddRichText and AutoCorrectEntries.Item.

For Each

Here is an example of processing the AutoCorrectEntry items in a collection.

Dim aceEntry As AutoCorrectEntry
For Each aceEntry In AutoCorrect.Entries
	
Next aceEntry

Apply

Replaces a range with the value of the specified AutoCorrect entry.

Apply (Range)

Range: The range to which to apply the AutoCorrect entry.

AutoCorrect.Entries.Add Name:= "sr", Value:= "Stella Richards" 
AutoCorrect.Entries("sr").Apply Selection.Range

Delete

Deletes the specified AutoCorrect entry.

AutoCorrect.Entries(1).Delete

Index

Returns a Long that represents the position of an item in a collection.

Dim lngIndex As Long
lngIndex = AutoCorrect.Entries(1).Index

Name

Returns or sets the name of the specified object.

AutoCorrect.Entries(1).Name =

RichText

True if formatting is stored with the AutoCorrect entry replacement text.

MsgBox AutoCorrect.Entries(1).RichText

Value

Returns or sets the value of the AutoCorrect entry.

The Value property only returns the first 255 characters of the object's value.

AutoCorrect.Entries.Add Name:="i.e.", Value:="that is" 
MsgBox AutoCorrect.Entries("i.e.").Value