在邮件合并中的所有记录合并成功后,该事件发生。
Private Sub object_MailMergeAfterMerge(ByVal Doc As Document, ByVal DocResult As Document)
object 在类模块事件中声明的 Application 类型对象。有关使用 Application 对象事件的详细信息,请参阅使用 Application 对象事件。
Doc 邮件合并主文档。
DocResult 邮件合并生成的文档。
该示例显示一条消息,说明指定文档中的所有记录已完成合并。如果将文档合并到第二篇文档,则消息中将包含新文档的名称。该示例假定在一般声明中声明了一个名为 MailMergeApp 的应用程序变量,并将 Word Application 对象赋给该变量。
Private Sub MailMergeApp_MailMergeAfterMerge(ByVal Doc As Document, _
ByVal DocResult As Document)
If DocResult Is Nothing Then
MsgBox "Your mail merge on " & _
Doc.Name & " is now finished."
Else
MsgBox "Your mail merge on " & _
Doc.Name & " is now finished and " & _
DocResult.Name & " has been created."
End If
End Sub