AutoTextEntry.Insert Method

Word Developer Reference

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.

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

See Also