Open Method

Microsoft Office Visual Basic

Show All Show All

Open Method

ShowAs it applies to the DocumentLibraryVersion object.

Opens the specified version of the shared document from the DocumentLibraryVersions collection in read-only mode.

expression.Open()

expression    Required. An expression that returns a DocumentLibraryVersion object.

ShowAs it applies to the HTMLProject and HTMLProjectItem objects.

Opens the specified HTML project or HTML project item in the Microsoft Script Editor in one of the views specified by the optional MsoHTMLProjectOpen constants listed below. If one of the constants is not specified, the project item is opened in the default view.

expression.Open(OpenKind)

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

OpenKind   Optional MsoHTMLProjectOpen. The view in which the specified project or project item is opened.

MsoHTMLProjectOpen can be one of these MsoHTMLProjectOpen constants.
msoHTMLProjectOpenSourceView
msoHTMLProjectOpenTextView

Remarks

The default view is determined by whether or not the Microsoft Script Editor is open when the Open method is executed. If the Script Editor is not open, the Open method starts the Script Editor in source view. If the Script Editor is already open, the Open method activates the Script Editor and displays the script in the current view.

Example

As it applies to the DocumentLibraryVersion object

The following example opens the previous saved version of the active document in read-only mode.

          Dim dlvVersions As Office.DocumentLibraryVersions
    Set dlvVersions = ActiveDocument.DocumentLibraryVersions
    dlvVersions(dlvVersions.Count - 1).Open
    Set dlvVersions = Nothing

    

As it applies to the HTMLProject object

This example opens the HTML project in the active workbook in source view.

AppActiveWorkbook.HTMLProject.Open _
    (msoHTMLProjectOpenSourceView)
		

As it applies to the HTMLProjectItem object

This example opens the first HTML project item in the active workbook in text view.

ActiveWorkbook.HTMLProject.HTMLProjectItems _
    Item(1).Open (msoHTMLProjectOpenTextView)