MailMergeAfterMergeEventHandler 委派
表示處理 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 中)
語法
'宣告
Public Delegate Sub MailMergeAfterMergeEventHandler ( _
sender As Object, _
e As MailMergeAfterMergeEventArgs _
)
public delegate void MailMergeAfterMergeEventHandler(
Object sender,
MailMergeAfterMergeEventArgs e
)
參數
- sender
型別:System.Object
事件的來源。
備註
在建立 MailMergeAfterMergeEventHandler 委派 (Delegate) 時,您要識別處理事件的方法。 若要讓此事件與您的事件處理常式產生關聯,請將委派的執行個體加入至此事件。 事件處理常式,每當事件發生,,除非您移除委派。
範例
下列程式碼會示範 MailMergeAfterMerge 事件的事件處理常式。 在所有合併列印中的記錄都已經成功合併之後,這個事件處理常式便會顯示一則訊息。
這是示範文件層級自訂的範例。
Private Sub DocumentMailMergeAfterMerge()
AddHandler Me.MailMergeAfterMerge, AddressOf ThisDocument_MailMergeAfterMerge
End Sub
Private Sub ThisDocument_MailMergeAfterMerge(ByVal sender As Object, ByVal e As _
Microsoft.Office.Tools.Word.MailMergeAfterMergeEventArgs)
MessageBox.Show("Your mail merge on " & Me.Name & " is now finished.")
End Sub
private void DocumentMailMergeAfterMerge()
{
this.MailMergeAfterMerge += new Microsoft.Office.Tools.Word.MailMergeAfterMergeEventHandler(ThisDocument_MailMergeAfterMerge);
}
void ThisDocument_MailMergeAfterMerge(object sender, Microsoft.Office.Tools.Word.MailMergeAfterMergeEventArgs e)
{
MessageBox.Show("Your mail merge on "
+ this.Name + " is now finished.");
}