DocumentBase.MailMergeBeforeRecordMerge Event

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Occurs as a merge is executed for the individual records in a merge.

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

public event CancelEventHandler MailMergeBeforeRecordMerge

To stop the mail merge process for the current record, set the Cancel argument of the provided CancelEventArgs to true.

The following code example displays a message before the first record is merged. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentMailMergeBeforeRecordMerge()
{
    this.MailMergeBeforeRecordMerge += new System.ComponentModel.CancelEventHandler(ThisDocument_MailMergeBeforeRecordMerge);
}

void ThisDocument_MailMergeBeforeRecordMerge(object sender, System.ComponentModel.CancelEventArgs e)
{
    string message = this.MailMerge.DataSource.DataFields[1].Value + " is now merging.";
    MessageBox.Show(message);
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft