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

Documents.Open Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Opens an existing file so that it can be edited.

Syntax

expression . Open( FileName )

expression A variable that represents a Documents object.

Parameters

NameRequired/OptionalData TypeDescription
FileNameRequiredStringThe name of a file to open.

Return Value

Document

Remarks

When you use the Open method to open a Document object, it opens a Microsoft Visio file as an original. Depending on the file name extension, the Open method opens a drawing (.vsd), a stencil (.vss), a template (.vst), a workspace (.vsw), an XML drawing (.vdx), an XML stencil (.vsx), or an XML template (.vtx). You can also use this method to open and convert non-Visio files to Visio files. If the file does not exist or the file name is invalid, no Document object is returned and an error is generated.

If you pass a valid stencil (.vss) file name, the original stencil file opens. Starting with Microsoft Office Visio 2003, only user-created stencils are editable. By default, Visio stencils are not editable. Unless you want to create or edit the masters, open a stencil as read-only.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to open a blank document, a new document based on a template, and an existing document.

Before running this macro, replace path \ filename with the path to and file name of a valid template file (.vst) on your computer.


Public Sub OpenDocument_Example() 

 Dim vsoDocument As Visio.Document 

 'Open a blank document (not based on a template). 
 Set vsoDocument = Documents.Add("") 

 'Open a new document based on a template. 
 Set vsoDocument = Documents.Add _ 
 ("path \filename ") 

 'Open an existing document. 
 Set vsoDocument = Documents.Open _ 
 ("path \filename ") 

End Sub
© 2018 Microsoft