Table of contents
TOC
Collapse the table of content
Expand the table of content

Application.Open Method (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Returns a Document object that represents the newly opened publication.

Syntax

expression. Open( Filename, ReadOnly, AddToRecentFiles, SaveChanges)

_expression_A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
FilenameRequiredStringThe name of the publication (paths are accepted).
ReadOnlyOptionalBooleanTrue to open the publication as read-only. Default is False.
AddToRecentFilesOptionalBooleanTrue (default) to add the file name to the list of recently used files at the bottom of the File menu.
SaveChangesOptionalPbSaveOptionsSpecifies what Microsoft Publisher should do if there is already an open publication with unsaved changes.
OpenConflictDocumentOptionalBooleanTrue 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 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 Visibleproperty 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.

The SaveChanges parameter can be one of the PbSaveOption constants declared in the Publisher type library and shown in the following table.

ConstantDescription
pbDoNotSaveChangesClose the open publication without saving any changes.
pbPromptToSaveChangesPrompt the user whether to save changes in the open publication. The default.
pbSaveChangesSave the open publication before closing it.

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

See also

Concepts

Application Object

© 2018 Microsoft