Share via


Application.DoCmd Method

Visio Automation Reference

Performs the command that has the indicated command ID.

Version Information
 Version Added:  Visio 4.0

Syntax

expression.DoCmd(CommandID)

expression   A variable that represents an Application object.

Parameters

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

Return Value
Nothing

Remarks

Constants for Microsoft Office 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 Automation Reference.

Example

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

Visual Basic for Applications
  
Public Sub DoCmd_Example() 
Dim vsoDocument As Visio.Document 

Set vsoDocument = Documents.Add("") 

Visio.Application.DoCmd (visCmdWindowShowMasterObjects) 

End Sub

See Also