Collapse the table of content
Expand the table of content
Expand Minimize

Document.MailMerge Property (Word)


Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a MailMerge object that represents the mail merge functionality for the specified document. Read-only.

expression .MailMerge

expression A variable that represents a Document object.

The MailMerge object is available regardless of whether the specified document is a mail merge main document. Use the State property to determine the current state of the mail merge operation.

This example executes a mail merge if the active document is a main document with an attached data source.

Set myMerge = ActiveDocument.MailMerge 
If myMerge.State = wdMainAndDataSource Then myMerge.Execute

This example merges the main document with records 1 through 4 and sends the merge documents to the printer.

With ActiveDocument.MailMerge 
 .DataSource.FirstRecord = 1 
 .DataSource.LastRecord = 4 
 .Destination = wdSendToPrinter 
 .SuppressBlankLines = True 
End With
© 2015 Microsoft