Application.MailMergeAfterMerge event (Publisher)
Occurs after all records in a mail merge have merged successfully.
Syntax
expression.MailMergeAfterMerge (Doc)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Doc | Required | Document | The mail merge main document. |
Remarks
To access the Application object events, declare an Application object variable in the General Declarations section of a code module, and then set the variable equal to the Application object for which you want to access events.
For information about using events with the Microsoft Publisher Application object, see Using events with the Application object.
Example
This example displays a message stating that all records in the specified document are finished merging.
Private Sub MailMergeApp_MailMergeAfterMerge(ByVal Doc As Document)
MsgBox "Your mail merge on " & _
ActiveDocument.Name & " is now finished."
End Sub
For this event to occur, you must place the following line of code in the General Declarations section of your module and run the following initialization routine.
Private WithEvents MailMergeApp As Application
Sub InitializeMailMergeApp()
Set MailMergeApp = Publisher.Application
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.