MailMergeAfterRecordMerge Event

Document.MailMergeAfterRecordMerge Event

 

Occurs after each record in the data source successfully merges in a mail merge.

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

event EventHandler MailMergeAfterRecordMerge

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

private void DocumentMailMergeAfterRecordMerge()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeAfterRecordMerge += new EventHandler(ThisDocument_MailMergeAfterRecordMerge);

}

void ThisDocument_MailMergeAfterRecordMerge(object sender, EventArgs e)
{
    object index = 1;
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show(vstoDoc.MailMerge.DataSource.DataFields.get_Item(ref index).Value
         + " is finished merging.");
}
Return to top
Show:
© 2016 Microsoft