Partager via


Document.MailMergeAfterMerge Event

Definition

Occurs after all records in a mail merge have merged successfully.

public:
 event Microsoft::Office::Tools::Word::MailMergeAfterMergeEventHandler ^ MailMergeAfterMerge;
event Microsoft.Office.Tools.Word.MailMergeAfterMergeEventHandler MailMergeAfterMerge;
member this.MailMergeAfterMerge : Microsoft.Office.Tools.Word.MailMergeAfterMergeEventHandler 
Event MailMergeAfterMerge As MailMergeAfterMergeEventHandler 

Event Type

Examples

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

private void DocumentMailMergeAfterMerge()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeAfterMerge += new Microsoft.Office.Tools.Word.MailMergeAfterMergeEventHandler(ThisDocument_MailMergeAfterMerge);
}

void ThisDocument_MailMergeAfterMerge(object sender, Microsoft.Office.Tools.Word.MailMergeAfterMergeEventArgs e)
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show("Your mail merge on " 
        + vstoDoc.Name + " is now finished.");
}
Private Sub DocumentMailMergeAfterMerge()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.MailMergeAfterMerge, AddressOf ThisDocument_MailMergeAfterMerge
End Sub

Private Sub ThisDocument_MailMergeAfterMerge(ByVal sender As Object, ByVal e As  _
    Microsoft.Office.Tools.Word.MailMergeAfterMergeEventArgs)
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    System.Windows.Forms.MessageBox.Show("Your mail merge on " & vstoDoc.Name & " is now finished.")
End Sub

Applies to