MailMergeField Object

MailMerge
MailMergeFields
MailMergeField
Multiple objects

Represents a single mail merge field in a document. The MailMergeDataField object is a member of the MailMergeDataFields collection. The MailMergeDataFields collection includes all the mail merge related fields in a document.

Using the MailMergeField Object

Use Fields(index), where index is the index number, to return a single MailMergeField object. The following example displays the field code of the first mail merge field in the active document.

MsgBox ActiveDocument.MailMerge.Fields(1).Code

Use the Add method to add a merge field to the MailMergeFields collection. The following example replaces the selection with a MiddleInitial merge field.

ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, _
    Name:="MiddleInitial"

Remarks

The MailMergeFields collection has additional methods, such as AddAsk and AddFillIn , for adding fields related to a mail merge operation.

Properties | Application Property | Code Property | Creator Property | Locked Property | Next Property | Parent Property | Previous Property | Type Property

Methods | Copy Method | Cut Method | Delete Method | Select Method

Parent Objects | MailMerge

Child Objects | MailMergeField | Range

See Also | Field Object | MailMergeDataSource Object