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

Documents.AddEx Method (Visio)

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

Adds a new stencil or drawing to the Documents collection, while permitting extra information to be passed in an argument.

Syntax

expression . AddEx( FileName , MeasurementSystem , Flags , LangID )

expression A variable that represents a Documents object.

Parameters

NameRequired/OptionalData TypeDescription
FileNameRequiredStringThe type or file name of the document to add; if you do not include a path, Microsoft Visio searches the folder or folders designated in the ** Application** object's TemplatePaths property and all published templates, including published third-party templates.
MeasurementSystemOptionalVisMeasurementSystemThe measurement units to use in the new document. See Remarks for possible values.
FlagsOptionalLongFlags that indicate how to open the new document. See Remarks for possible values.
LangIDOptionalLongThe language ID for the document. See Remarks.

Return Value

Document

Remarks

The AddEx method is similar to the Add method as it applies to the Documents collection, except that AddEx provides several additional arguments in which the caller can specify how the document is created.

The MeasurementSystem argument should be one of the following members of VisMeasurementSystem , which is declared in the Visio type library.

ConstantValueDescription
visMSDefault0Choose metric or US depending on regional options set in Control Panel.
visMSMetric1Metric measurement system.
visMSUS2US units measurement system.

The Flags argument should be a combination of one or more of the following members of VisOpenSaveArgs , which is declared in the Visio type library.

ConstantValueDescription
visAddDocked4Adds a document in a docked window.
visAddHidden64Adds a document in a hidden window.
visAddMacrosDisabled128Adds a document with macros disabled.
visAddMinimized16Adds a document in a minimized window.
visAddNoWorkspace256Adds a document with no workspace information.
visAddStencil512Adds a new stencil file.

The LangID argument should be one of the standard IDs used by Microsoft Windows to encode different language versions. For example, the language ID is &;H0409 for the U.S. version of Visio. To see a list of language IDs, search for "VERSIONINFO" in the Microsoft Platform SDK on MSDN.

To create a new drawing based on no template, pass a zero-length string ("") to the AddEx method.

To create a new drawing based on a template, pass "templatename.vst" to the AddEx 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").

Note Opening a copy of a stencil or drawing is equivalent to selecting Open as Copy in the Open list in the Open dialog box or using the OpenEx method with the visOpenCopy flag.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the AddEx method to create a document based on the "BASICD_U.VST" template that uses the default measurement system units.

Public Sub AddEx_Example() 

 Application.Documents.AddEx "BASICD_U.VST", visMSDefault 

End Sub
© 2018 Microsoft