|Visio Automation Reference|
Version Added: Visio 2.0
expression A variable that represents a Documents object.
|FileName||Required||String||The type or file name of the document to add; if you do not include a path, Visio searches the folder or folders designated in the Application object's TemplatePaths property and all published templates, including published third-party templates.|
To create a new drawing based on no template, pass a zero-length string ("") to the Add method.
To create a new drawing based on a template, pass "templatename.vst" to the Add method. Visio opens stencils that are part of the template's workspace and copies styles and other settings associated with the template to the new document. If the template file name is invalid, no document is returned and an error is generated.
To create a new stencil based on no stencil, pass ("vss").
To open a copy of a stencil, pass ("stencilname.vss").
To open a copy of a drawing, pass ("drawingname.vsd").
|Opening a copy of a stencil or drawing is equivalent to selecting Copy in the Open list box of the Open dialog box or using the OpenEx method with the visOpenCopy flag.|
The following macro shows how to add Document objects such as templates, stencils, and drawings to the Documents collection.
Before running this macro, replace Myfile.vsd with a valid .vsd file.
|Visual Basic for Applications|