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

InvisibleApp.VBAEnabled Property (Visio)

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

Specifies whether Microsoft Visual Basic for Applications (VBA) is enabled in the application. Read-only.


expression . VBAEnabled

expression A variable that represents an InvisibleApp object.

Return Value



If a document that contains a VBA project is opened with VBA enabled, and then VBA becomes disabled while the document is open:

  • Microsoft Visio no longer executes macros in that document, but the macro names still appear in the Macros dialog box (press Alt+F8).

  • Visio continues firing events to the project.

If a document that contains a VBA project is opened with VBA disabled, and then VBA becomes enabled while the document is open:

  • Visio does not fire events to the project, even though VBA has become enabled.

  • Macros remain disabled.

The VBAEnabled property is set to True if 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 (click the BackstageButton tab, click Options, click Trust Center, and then click Trust Center Settings). If it is not selected, the property reports False .


You may have a document that requires VBA to be enabled to run properly, for example, code in a document's DocumentOpened event handler. The following code can be run from an add-on to verify whether VBA is enabled in the application before a document that depends on VBA is opened.

Before running this procedure, supply a valid document file name for the variable filename .

Public Sub VBAEnabled_Example() 

 Dim vsoDocument As Visio.Document 
 Dim blsStatus As Boolean 

 blsStatus = Application.VBAEnabled 
 If Not blsStatus Then 

 MsgBox "For this process to continue, VBA must be enabled." &; _ 
 " Please enable VBA and start over." 


 Set vsoDocument = Documents.Open("filename ") 

 End if 

End Sub
© 2018 Microsoft