Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Visio Automation Reference |
Returns a reference to the CommandBars collection that represents the command bars in the container application. Read-only.
Version Information
Version Added: Visio 2002
Syntax
expression.CommandBars
expression A variable that represents an Application object.
Return Value
CommandBars
Remarks
Beginning with Microsoft Visio 2002, a program can manipulate menus and toolbars in the Visio user interface by manipulating the CommandBars collection returned by the CommandBars property. The CommandBars collection has an interface identical to the CommandBars collection exposed by the suite of Microsoft Office applications such as Microsoft Word and Microsoft Excel.
Alternatively, since Visio version 4.0, Visio has exposed application and document properties that return a UIObject object that provides similar functionality to CommandBars. Consequently, programs can use either the CommandBars collection or UIObject objects to manipulate the Visio menus and toolbars.
To get information about the object returned by the CommandBars property:
![]() |
---|
Each CommandBarControl object in a CommandBars collection has an OnAction property, and each CommandBar object in a CommandBars collection has a Context property. The values of these properties are determined by the container application. In Microsoft Office Visio: |
For more information about using the OnAction and Context properties in Visio, see Developing Microsoft Visio Solutions on MSDN, the Microsoft Developer Network.
Example
This macro shows how to use the CommandBars property to list the command bars.
Visual Basic for Applications |
---|
|
See Also
Please sign in to use this experience.
Sign in