Share via


Open Method [Publisher 2003 VBA Language Reference]

Returns a Document object that represents the newly opened publication.

expression.Open(FileName, ReadOnly, AddToRecentFiles, SaveChanges, OpenConflictDocument)

expression Required. An expression that returns one of the objects in the Applies To list.

FileName  Required String. The name of the publication (paths are accepted).

ReadOnly  Optional Boolean. True to open the publication as read-only. Default is False.

AddToRecentFiles  Optional Boolean. True (default) to add the file name to the list of recently used files at the bottom of the File menu.

PbSaveOptions

PbSaveOptions can be one of these PbSaveOptions constants.
pbDoNotSaveChanges Close the open publication without saving any changes.
pbPromptToSaveChangesdefault Prompt the user whether to save changes in the open publication.
pbSaveChanges Save the open publication before closing it.

OpenConflictDocument  Optional Boolean. True to open the local conflict publication if there is an offline conflict. Default is False.

Remarks

Since Publisher has a single document interface, the Open method only works when you open a new instance of Publisher. The code sample below shows how to create a new, visible instance of Publisher. When finished with the second instance, you can set the application window's Visible property to False, but the process continues to run in the background even though it isn't visible. To close the second instance, you must set the object equal to Nothing.

Example

This example creates a second instance of Publisher and opens the specified publication as read-only. (Note that PathToFile must be replaced with the path to an existing publication for this example to work.)

Sub OpenNewPub()
    Dim appPub As New Publisher.Application
    appPub.Open FileName:="PathToFile", _
        ReadOnly:=True, AddToRecentFiles:=False, _
        SaveChanges:=pbPromptToSaveChanges
    appPub.ActiveWindow.Visible = True
End Sub

Applies to | Application Object