Share via


Open Method

Home Page (Objects)OverviewFAQReference

Applies to: Documents object

Opens a document with a specified file name.

Syntax

object**.OpenPathName[,OpenAs ][,**ReadOnly]

Parameters

object

An expression that evaluates to a Documents object.

PathName

A String that specifies the full path to the document.

OpenAs

(Optional) A Variant that is a String specifying the document type when the document opens. Possible values are:

  • "Text"   Opens the document as a text file.

  • "Auto"   Opens the document in the default editor (the default).

ReadOnly

(Optional) A Variant that is a Boolean specifying whether the document is read-only. Possible values are:

  • True   Opens as read-only.

  • False   Opens as read/write (the default).

Example

The following example opens the macro file C:\ Program Files\Microsoft Visual Studio\Common\MSDEV98\Macros\Sample.dsm as read-only:

Documents.Open "C:\Program Files\Microsoft Visual Studio\Common\MSDEV98\Macros\Sample.dsm",,True

See Also   Close method, CloseAll method.