Document.MailMergeAfterRecordMerge Event

Definition

Occurs after each record in the data source successfully merges in a mail merge.

public:
 event EventHandler ^ MailMergeAfterRecordMerge;
event EventHandler MailMergeAfterRecordMerge;
member this.MailMergeAfterRecordMerge : EventHandler 
Event MailMergeAfterRecordMerge As EventHandler 

Event Type

Examples

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

private void DocumentMailMergeAfterRecordMerge()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeAfterRecordMerge += new EventHandler(ThisDocument_MailMergeAfterRecordMerge);

}

void ThisDocument_MailMergeAfterRecordMerge(object sender, EventArgs e)
{
    object index = 1;
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    System.Windows.Forms.MessageBox.Show(vstoDoc.MailMerge.DataSource.DataFields.get_Item(ref index).Value
         + " is finished merging.");
}
Private Sub DocumentMailMergeAfterRecordMerge()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.MailMergeAfterRecordMerge, AddressOf ThisDocument_MailMergeAfterRecordMerge
End Sub

Private Sub ThisDocument_MailMergeAfterRecordMerge(ByVal sender As Object, ByVal e As EventArgs)
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    Dim index As Object = 1
    System.Windows.Forms.MessageBox.Show(vstoDoc.MailMerge.DataSource.DataFields.Item(index).Value & _
        " is finished merging.")
End Sub

Applies to