Document.MailMergeWizardSendToCustom Event

 

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

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

event EventHandler MailMergeWizardSendToCustom

Use the P:Microsoft.Office.Interop.Word.MailMerge.ShowSendToCustom property to create a custom button on the sixth step of the Mail Merge Wizard.

The following code example executes a merge when you click the custom destination button. This example assumes that you have access to a custom destination button. This example is for an application-level add-in.

private void DocumentMailMergeWizardSendToCustom()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeWizardSendToCustom += new 
        EventHandler(ThisDocument_MailMergeWizardSendToCustom);
}

void ThisDocument_MailMergeWizardSendToCustom(object sender, EventArgs e)
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMerge.ShowSendToCustom = "Custom Destination";
    vstoDoc.MailMerge.Destination = Microsoft.Office.Interop
        .Word.WdMailMergeDestination.wdSendToNewDocument;
    vstoDoc.MailMerge.Execute(ref missing);
}
Return to top
Show: