InsertMailMergeField Method

       

Returns a TextRange object that represents a mail merge field.

expression.InsertMailMergeField(varIndex)

expression   Required. An expression that returns one of the objects in the Applies To list.

varIndex  Required Variant. The name of the field.

Example

This example inserts a LastName field at the cursor position. This example assumes that the active publication is a mail merge publication and that the insertion point is somewhere inside a text box.

Sub InsertMergeField()
    Selection.TextRange.InsertMailMergeField varIndex:="LastName"
End Sub