Document.VBProject Property
Visio Automation Reference |
Returns an automation object that you can use to control the Microsoft Visual Basic for Applications (VBA) project of the document. Read-only.
Version Information
Version Added: Visio 4.5
Syntax
expression.VBProject
expression A variable that represents a Document object.
Return Value
Object
Remarks
To get information about the object returned by the VBProject property
- On the Tools menu, point to Macro, and then click Visual Basic Editor.
- In the Visual Basic Editor, on the Tools menu, click References.
- In the References dialog box, click Microsoft Visual Basic for Applications Extensibility 5.3, and then click OK.
- On the View menu, click Object Browser.
- In the Project/Library list, select the VBIDE type library.
- In the Classes list, examine the class named VBProject.
If no VBA project already exists in the document, the VBProject property creates one.
Beginning with Visio 2002, the VBProject property raises an exception if you are running in a security-enhanced environment and your system administrator has blocked access to the Visual Basic object model. There is no user interface or programmatic way to turn this on—the system administrator must turn on (or off) access by setting a Group Policy. This helps protect against viruses that spread by accessing the Visual Basic projects in commonly used templates and injecting the virus code into them.
Example
This VBA macro shows how to print the names of libraries referenced by a VBA project in the Immediate window.
Before running this code, make sure the Trust access to the VBA project object model check box is selected under Developer Macro Settings on the Macro Settings page of the Trust Center dialog box (on the Tools menu, click Trust Center, and then click Macro Settings).
Visual Basic for Applications |
---|
|
See Also