Sdílet prostřednictvím


DocumentBase.MailMergeBeforeMerge Event

Definition

Occurs when a merge is executed, before any records merge.

public:
 event EventHandler ^ MailMergeBeforeMerge;
public event EventHandler MailMergeBeforeMerge;
member this.MailMergeBeforeMerge : EventHandler 
Public Custom Event MailMergeBeforeMerge As EventHandler 

Event Type

Examples

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.");
}
Private Sub DocumentMailMergeBeforeMerge()
    AddHandler Me.MailMergeBeforeMerge, AddressOf ThisDocument_MailMergeBeforeMerge
End Sub

Private Sub ThisDocument_MailMergeBeforeMerge(ByVal sender As Object, ByVal e As EventArgs)
    MessageBox.Show("Your mail merge on " & Me.Name & " is now starting.")
End Sub

Remarks

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

Applies to