Share via


Close Method [Publisher 2003 VBA Language Reference]

Close method as it applies to the Document object.

Closes the current publication and creates a blank one in its place.

expression.Close

expression Required. An expression that returns a Document object.

Remarks

You can only use the Close method on an open Document object in another instance of Publisher. Attempting to close the active publication in the current instance of Publisher causes an error.

Close method as it applies to the MailMergeDataSource object.

Closes the specified mail merge data source, cancels the mail merge, and converts all mail merge data fields to plain text.

expression.Close

expression Required. An expression that returns a MailMergeDataSource object.

Example

As it applies to the Document object.

This example opens a publication in a new instance of Publisher for modification and then closes the publication. (Note that Filename must be replaced with a valid file name for this example to work.)

Sub ModifyAnotherPublication()
    ' Create new instance of Publisher.
    Dim appPub As New Publisher.Application

    ' Open publication.
    appPub.Open FileName:="Filename"

    ' Put code here to modify the publication as necessary.

    ' Close the publication.
    appPub.ActiveDocument.Close

    ' Release the other instance of Publisher.
    Set appPub = Nothing
End Sub

As it applies to the MailMergeDataSource object.

The following example closes the data source for the active mail merge publication.

ActiveDocument.MailMerge.DataSource.Close

Applies to | Document Object | MailMergeDataSource Object