MailMerge.Execute method (Publisher)
Performs the specified mail merge or catalog merge operation. Returns a Document object that represents the new or existing publication specified as the destination of the merge results. Returns Nothing if the merge is executed to a printer.
Syntax
expression.Execute (Pause, Destination, FileName)
expression A variable that represents a MailMerge object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Pause | Required | Boolean | True to have Microsoft Publisher pause and display a troubleshooting dialog box if a merge error is found. False to ignore errors during a mail merge or catalog merge. |
Destination | Optional | PbMailMergeDestination | The destination of the mail merge or catalog merge results. Can be one of the PbMailMergeDestination constants; the default is pbSendToPrinter. Specifying pbSendToPrinter for a catalog merge results in a run-time error. |
FileName | Optional | String | The file name of the publication to which you want to append the catalog merge results. |
Return value
Document
Example
This example executes a mail merge if the active publication is a main document with an attached data source.
Sub ExecuteMerge()
Dim mrgDocument As MailMerge
Set mrgDocument = ActiveDocument.MailMerge
If mrgDocument.DataSource.ConnectString <> "" Then
mrgDocument.Execute Pause:=False
End If
End Sub
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.