Application.Open method (Publisher)

Returns a Document object that represents the newly opened publication.

Syntax

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

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
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. Can be one of the PbSaveOptions constants declared in the Publisher type library.
OpenConflictDocument Optional Boolean True to open the local conflict publication if there is an offline conflict. Default is False.

Return value

Document

Remarks

Because Publisher has a single document interface, the Open method works only when you open a new instance of Publisher. The following code sample 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 is not 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. For this example to work, you must replace PathToFile with the path to an existing publication.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.