共用方式為


DocumentBase.MailMergeAfterRecordMerge Event

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

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Event MailMergeAfterRecordMerge As EventHandler
public event EventHandler MailMergeAfterRecordMerge

Examples

The following code example displays a message when the MailMergeAfterRecordMerge event is raised. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentMailMergeAfterRecordMerge()
    AddHandler Me.MailMergeAfterRecordMerge, AddressOf ThisDocument_MailMergeAfterRecordMerge
End Sub 

Private Sub ThisDocument_MailMergeAfterRecordMerge(ByVal sender As Object, ByVal e As EventArgs)
    Dim index As Object = 1
    MessageBox.Show(Me.MailMerge.DataSource.DataFields.Item(index).Value & _
        " is finished merging.")
End Sub
private void DocumentMailMergeAfterRecordMerge()
{
    this.MailMergeAfterRecordMerge += new EventHandler(ThisDocument_MailMergeAfterRecordMerge);

}

void ThisDocument_MailMergeAfterRecordMerge(object sender, EventArgs e)
{
    object index = 1;
    MessageBox.Show(this.MailMerge.DataSource.DataFields.get_Item(ref index).Value
         + " is finished merging.");
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace