共用方式為


Document.MailMergeAfterMerge 事件

當成功地合併在合併列印中的所有記錄之後發生。

命名空間:  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 MailMergeAfterMerge As MailMergeAfterMergeEventHandler
event MailMergeAfterMergeEventHandler MailMergeAfterMerge

範例

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

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

.NET Framework 安全性

請參閱

參考

Document 介面

Microsoft.Office.Tools.Word 命名空間