Application.DoCmd method (Visio)

Performs the command that has the indicated command ID.


expression.DoCmd (CommandID)

expression A variable that represents an Application object.


Name Required/Optional Data type Description
CommandID Required Integer The command to perform.

Return value



Constants for Microsoft Visio command IDs are declared by the Visio type library in VisUICmds and are prefixed with visCmd.

The DoCmd method works best with commands that display dialog boxes.

For a list of commands that can be used with the DoCmd method, see the topic DoCmd/DOCMD Commands in this reference.


The following macro shows how to use constants with the DoCmd method. It opens a new document and displays the document stencil.

Public Sub DoCmd_Example() 
 Dim vsoDocument As Visio.Document 
 Set vsoDocument = Documents.Add("") 
 Visio.Application.DoCmd (visCmdWindowShowMasterObjects) 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.