DocumentBase.MailMergeBeforeMerge Event

Occurs when a merge is executed, before any records 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 EventHandler MailMergeBeforeMerge

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

The following code example displays a message before any manual mail merge is run. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentMailMergeBeforeMerge()
{
    this.MailMergeBeforeMerge += new EventHandler(ThisDocument_MailMergeBeforeMerge);
}

void ThisDocument_MailMergeBeforeMerge(object sender, EventArgs e)
{
    MessageBox.Show("Your mail merge on "
        + this.Name + " is now starting.");
}

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