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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。