AutoTextEntries.Add method (Word)

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

Syntax

expression.Add (Name, Range)

expression Required. A variable that represents an 'AutoTextEntries' collection.

Parameters

Name Required/Optional Data type Description
Name Required String The text that, when typed, initiates an AutoText entry.
Range Required Range A range of text that will be inserted whenever Name is typed.

Example

This example adds an AutoText entry named Sample Text that contains the text in the selection. This example assumes you have text selected in the active document.

Sub AutoTxt() 
 NormalTemplate.AutoTextEntries.Add Name:="Sample Text", _ 
 Range:=Selection.Range 
End Sub

See also

AutoTextEntries Collection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.