Document.MailMergeAfterMerge Event

 

Occurs after all records in a mail merge have merged successfully.

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

event MailMergeAfterMergeEventHandler MailMergeAfterMerge

The following code example displays a message when the MailMergeAfterMerge event is raised. This example is for an application-level add-in.

private void DocumentMailMergeAfterMerge()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeAfterMerge += new Microsoft.Office.Tools.Word.MailMergeAfterMergeEventHandler(ThisDocument_MailMergeAfterMerge);
}

void ThisDocument_MailMergeAfterMerge(object sender, Microsoft.Office.Tools.Word.MailMergeAfterMergeEventArgs e)
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show("Your mail merge on " 
        + vstoDoc.Name + " is now finished.");
}
Return to top
Show: