Class AutoTextEntry (Word VBA)

The class AutoTextEntry represents a single AutoText entry. The AutoTextEntry object is a member of the AutoTextEntries collection. The AutoTextEntries collection contains all the AutoText entries in the specified template. The entries are listed on the AutoText tab in the AutoCorrect dialog box.

The main procedures of class AutoTextEntry are AutoTextEntries.Add and Delete

Set

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

Dim ate as AutoTextEntry
Set ate = Dim strName As String: strName = 
Dim strStyleName As String: strStyleName = 
Selection.CreateAutoTextEntry(Name:=strName, StyleName:=strStyleName)

The following procedures can be used to set variables of type AutoTextEntry: AutoTextEntries.Add, AutoTextEntries.Item, AutoTextEntries.AppendToSpike and Selection.CreateAutoTextEntry

Themes

The following procedures in this class have been grouped together and are described on a separate theme page

Name with its procedures Name and StyleName

Methods

These are the main methods of the AutoTextEntry class

AutoTextEntries.Add - Returns an AutoTextEntry object that represents an AutoText entry added to the list of available AutoText entries.

Dim strName As String: strName = 
Dim ates As AutoTextEntries: Set ates =  
Dim ate As AutoTextEntry
Set ate = ates.Add(Name:=strName, Range:=)

Delete - Deletes the specified object.

Selection.CreateAutoTextEntry.Delete

Other Methods

Insert - Inserts the AutoText entry in place of the specified range. Returns a Range object that represents the AutoText entry.

Dim rngInsert As Range
Set rngInsert = Selection.CreateAutoTextEntry.Insert(Where:=)

Properties

AutoTextEntries.Count returns the number of items in the AutoTextEntries collection.

Dim ates As AutoTextEntries: Set ates =  
Dim lngCount As Long
lngCount = ates.Count

AutoTextEntries.Parent returns an object that represents the parent object of the specified AutoTextEntries collection.

Dim ates As AutoTextEntries: Set ates =  
Dim objParent As Object
Set objParent = ates.Parent

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

Dim lngIndex As Long
lngIndex = Selection.CreateAutoTextEntry.Index

Parent returns an object that represents the parent object of the specified AutoTextEntries collection.

Dim objParent As Object
Set objParent = Selection.CreateAutoTextEntry.Parent

Value returns or sets the value of the AutoText entry.

Selection.CreateAutoTextEntry.Value =