ToolbarItem.CmdNum Property
Visio Automation Reference |
Gets or sets the command ID associated with an accelerator, menu, menu item, or toolbar item. Read/write.
Version Information
Version Added: Visio 4.0
Syntax
expression.CmdNum
expression A variable that represents a ToolbarItem object.
Return Value
Integer
Remarks
When the AddOnName property of a MenuItem or ToolbarItem object indicates an add-on to run, Microsoft Office Visio automatically assigns a CmdNum property.
The CmdNum property should never be zero for an AccelItem object.
To insert a separator in a menu preceding a MenuItem object or a spacer in a toolbar preceding a ToolbarItem object, use the BeginGroup property.
Valid command IDs are declared by the Visio type library in VisUICmds. They have the prefix visCmd.
Example
This Microsoft Visual Basic for Applications (VBA) macro shows how use the CmdNum property to get a particular built-in Visio toolbar button, and then it shows how to change the button's icon. The new icon persists as long as the document is active.
This macro assumes you are not using a custom user interface (UI).
Before running this macro, replace fullpath\filename in the following code with the full path to and file name of an icon file (.ico) on your computer.
To restore the built-in toolbars in Visio after you run this macro, call the ThisDocument.ClearCustomToolbars method.
Visual Basic for Applications |
---|
|
See Also