Document.MailMergeBeforeMerge 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在合并任何记录之前于执行合并时发生。
event EventHandler MailMergeBeforeMerge;
事件类型
示例
下面的代码示例在运行任何手动邮件合并之前显示一条消息。 此示例适用于应用程序级外接程序。
private void DocumentMailMergeBeforeMerge()
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.MailMergeBeforeMerge += new EventHandler(ThisDocument_MailMergeBeforeMerge);
}
void ThisDocument_MailMergeBeforeMerge(object sender, EventArgs e)
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
System.Windows.Forms.MessageBox.Show("Your mail merge on "
+ vstoDoc.Name + " is now starting.");
}
Private Sub DocumentMailMergeBeforeMerge()
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
AddHandler vstoDoc.MailMergeBeforeMerge, AddressOf ThisDocument_MailMergeBeforeMerge
End Sub
Private Sub ThisDocument_MailMergeBeforeMerge(ByVal sender As Object, ByVal e As EventArgs)
Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
System.Windows.Forms.MessageBox.Show("Your mail merge on " & vstoDoc.Name & " is now starting.")
End Sub
注解
若要停止邮件合并过程,请将 Cancel 提供的的参数设置 CancelEventArgs 为 true 。