MailMergeWizardSendToCustom Event

       

Occurs when the custom destination button is clicked on step six of the Mail Merge Wizard. 

Private Sub object_MailMergeWizardSendToCustom(ByVal Doc As Document)

object  A variable which references an object of type Application declared with events in a class module.

Doc  Required. The mail merge main document.

Remarks

Use the ShowSendToCustom property to create a custom destination button.

To access the Application object events, declare an Application object variable in the General Declarations section of a code module. 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 executes a merge to a fax machine when a user clicks on the custom destination button.

Private Sub MailMergeApp_MailMergeWizardSendToCustom(ByVal Doc As Document)
    With Doc.MailMerge
        .Destination = wdSendToFax
        .Execute
    End With
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