Open Method

       

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.

SaveChanges  Optional PbSaveOptions. Specifies what Microsoft Publisher should do if there is already an open publication with unsaved changes.

PbSaveOptions can be one of these PbSaveOptions constants.
pbDoNotSaveChanges  Close the open publication without saving any changes. 
pbPromptToSaveChanges default  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 Microsoft 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. This example assumes that a publication named "Publication1.pub" exists.

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