Share via


Execute Method [Publisher 2003 VBA Language Reference]

As it applies to the FindReplace object.

Performs the specified Find or Replace operation.

expression.Execute

expression Required. An expression that returns a FindReplace object.

Note  Be sure to set the FindText property before calling the Execute method to avoid a run time error.

As it applies to the MailMerge object.

Performs 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.

expression.Execute(Pause, Destination, Filename)

expression Required. An expression that returns a MailMerge object.

Pause  Required Boolean. True to have Publisher pause and display a troubleshooting dialog box if a merge error is found. False to ignore errors during mail merge or catalog merge.

PbMailMergeDestination

PbMailMergeDestination can be one of these PbMailMergeDestination constants.
pbSendToPrinterDefault
pbMergeToNewPublication
pbMergeToExistingPublication

Filename  Optional String. The file name of the publication to which you want to append the catalog merge results.

Example

As it applies to the FindReplace object.

This example executes a Find and Replace operation on the active document.

Sub ExecuteFindReplace()
    Dim objFindReplace As FindReplace
    Set objFindReplace = ActiveDocument.Find
    With objFindReplace
        .Clear
        .FindText = "library"
        .Execute
    End With
End Sub

As it applies to the MailMerge object.

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

Applies to | FindReplace Object | MailMerge Object