Table of contents
TOC
折叠目录
展开目录

MailMerge.Execute 方法 (发布服务器)MailMerge.Execute Method (Publisher)

office 365 dev account|上次更新日期: 2018/3/13
|
3 参与人员

执行指定的邮件合并或目录合并操作。返回一个Document对象,该对象表示指定为合并结果的目标的新的或现有出版物。如果打印机执行合并,则将返回NothingPerforms the specified mail merge or catalog merge operation. Returns a Document object that represents the new or existing publication specified as the destination of the merge results. Returns Nothing if the merge is executed to a printer.

语法Syntax

表达式执行(暂停目标文件名)expression. Execute( Pause, Destination, Filename)

_expression_A 变量,表示邮件合并对象。_expression_A variable that represents a MailMerge object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
暂停Pause必需RequiredBooleanBoolean真正让 Microsoft Publisher 暂停并显示一个对话框,如果发现合并错误。可在邮件合并或目录合并过程中忽略的错误。True to have Microsoft Publisher pause and display a troubleshooting dialog box if a merge error is found. False to ignore errors during mail merge or catalog merge.
目标Destination可选OptionalPbMailMergeDestinationPbMailMergeDestination邮件合并或目录合并结果的目标。指定pbSendToPrinter的目录合并结果中出现运行时错误。The destination of the mail merge or catalog merge results. Specifying pbSendToPrinter for a catalog merge results in a run-time error.
文件名Filename可选OptionalStringString要将目录合并结果追加到的出版物的文件名。The file name of the publication to which you want to append the catalog merge results.

返回值Return Value

DocumentDocument

注解Remarks

目标可以是其中一个PbMailMergeDestination常量。默认值为pbSendToPrinterDestination can be one of these PbMailMergeDestination constants. The default is pbSendToPrinter.

| pbSendToPrinter| |pbMergeToNewPublication| |pbMergeToExistingPublication|| pbSendToPrinter| | pbMergeToNewPublication| | pbMergeToExistingPublication|

示例Example

如果活动出版物是具有附加数据源的主文档,则本示例将执行邮件合并。This example executes a mail merge if the active publication is a main document with an attached data source.

Sub ExecuteMerge() 
 Dim mrgDocument As MailMerge 
 Set mrgDocument = ActiveDocument.MailMerge 
 If mrgDocument.DataSource.ConnectString <> "" Then 
 mrgDocument.Execute Pause:=False 
 End If 
End Sub
© 2018 Microsoft