共用方式為


MailMergeAfterMergeEventHandler Delegate

Definition

Represents the method that handles the MailMergeAfterMerge event of a Document.

public delegate void MailMergeAfterMergeEventHandler(System::Object ^ sender, MailMergeAfterMergeEventArgs ^ e);
public delegate void MailMergeAfterMergeEventHandler(object sender, MailMergeAfterMergeEventArgs e);
type MailMergeAfterMergeEventHandler = delegate of obj * MailMergeAfterMergeEventArgs -> unit
Public Delegate Sub MailMergeAfterMergeEventHandler(sender As Object, e As MailMergeAfterMergeEventArgs)

Parameters

sender
Object

The source of the event.

Examples

The following code example demonstrates an event handler for the MailMergeAfterMerge event. The event handler displays a message after all records in a mail merge have merged successfully.

This example is for a document-level customization.

private void DocumentMailMergeAfterMerge()
{
    this.MailMergeAfterMerge += new Microsoft.Office.Tools.Word.MailMergeAfterMergeEventHandler(ThisDocument_MailMergeAfterMerge);
}

void ThisDocument_MailMergeAfterMerge(object sender, Microsoft.Office.Tools.Word.MailMergeAfterMergeEventArgs e)
{
    MessageBox.Show("Your mail merge on " 
        + this.Name + " is now finished.");
}
Private Sub DocumentMailMergeAfterMerge()
    AddHandler Me.MailMergeAfterMerge, AddressOf ThisDocument_MailMergeAfterMerge
End Sub

Private Sub ThisDocument_MailMergeAfterMerge(ByVal sender As Object, ByVal e As  _
    Microsoft.Office.Tools.Word.MailMergeAfterMergeEventArgs)
    MessageBox.Show("Your mail merge on " & Me.Name & " is now finished.")
End Sub

Remarks

When you create a MailMergeAfterMergeEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, until you remove the delegate..

Applies to