邮件合并中,在数据源中的每一条记录合并成功后,该事件发生。
Private Sub object_MailMergeAfterRecordMerge(ByVal Doc As Document)
object 在类模块事件中声明的 Application 类型对象。有关使用 Application 对象事件的详细信息,请参阅使用 Application 对象事件。
Doc 邮件合并主文档。
该示例显示一条消息,以及刚完成合并的记录中第一个和第二个域的值。该示例假定在一般声明中声明了一个名为 MailMergeApp 的应用程序变量,并将 Word Application 对象赋给该变量。
Private Sub MailMergeApp_MailMergeAfterRecordMerge(ByVal Doc As Document)
With Doc.MailMerge.DataSource
MsgBox .DataFields(1).Value & " " & _
.DataFields(2).Value & " is finished merging."
End With
End Sub