Global.Vbe Property (Visio)
Gets the root object of the object model exposed by Microsoft Visual Basic for Applications (VBA). Use this property to access and manipulate the VBA projects associated with currently open Microsoft Visio documents. Read-only.
expression A variable that represents a Global object.
To get information about the object returned by the Vbe property, follow these steps:
To get information about the object returned by the Vbe property
In the Code group on theDeveloper tab, click Visual Basic.
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 VBE.
Beginning with Visio 2002, the Vbe property raises an exception if you are running in a security-enhanced environment and your system administrator has blocked access to the VBA 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.
This VBA macro shows how to use the Vbe property to determine how many VBA projects are open in an instance of Visio.
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 (click the File tab, click Options, click Trust Center, and then click Trust Center Settings).
Public Sub Vbe_Example() Dim vbideVBE As VBIDE.VBE Set vbideVBE = Visio.Application.Vbe Debug.Print vbideVBE.VBProjects.Count End Sub