共用方式為


Document.MailMergeAfterRecordMerge 事件

當資料來源中的每項記錄都成功地合併至合併列印之後發生。

命名空間:  Microsoft.Office.Tools.Word
組件:   Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
  Microsoft.Office.Tools.Word (在 Microsoft.Office.Tools.Word.dll 中)

語法

'宣告
Event MailMergeAfterRecordMerge As EventHandler
event EventHandler MailMergeAfterRecordMerge

範例

下列程式碼範例會在引發 MailMergeAfterRecordMerge 事件時顯示訊息。 這是應用程式層級增益集的範例。

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
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.");
}

.NET Framework 安全性

請參閱

參考

Document 介面

Microsoft.Office.Tools.Word 命名空間