AutoTextEntry.Insert method (Word)

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

Syntax

expression.Insert (Where, RichText)

expression Required. A variable that represents an 'AutoTextEntry' object.

Parameters

Name Required/Optional Data type Description
Where Required Range The location for the AutoText entry.
RichText Optional Variant True to insert the AutoText entry with its original formatting.

Return value

Range

Remarks

If you don't want to replace the range, use the Collapse method before using this method.

Example

This example inserts the formatted AutoText entry named "one" after the selection.

Sub InsertAutoTextEntry() 
 ActiveDocument.Content.Select 
 Selection.Collapse Direction:=wdCollapseEnd 
 ActiveDocument.AttachedTemplate.AutoTextEntries("one").Insert _ 
 Where:=Selection.Range, RichText:=True 
End Sub

See also

AutoTextEntry 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.