Upravit

Sdílet prostřednictvím


Application.BuiltInMenus property (Visio)

Returns a UIObject object that represents a copy of the built-in Microsoft Visio menus and accelerators. Read-only.

Note

Starting with Visio 2010, the Microsoft Office Fluent user interface (UI) replaced the previous system of layered menus, toolbars, and task panes. VBA objects and members that you used to customize the user interface in previous versions of Visio are still available in Visio, but they function differently.

Syntax

expression.BuiltInMenus

expression A variable that represents an Application object.

Return value

UIObject

Remarks

Use the BuiltInMenus property to obtain a UIObject object and modify its menus and accelerators. You can then use the SetCustomMenus method of an Application or Document object to add your customized menus and accelerators to the built-in Visio user interface.

You can also use the SaveToFile method of the UIObject object to store its menus in a file and reload them as custom menus by setting the CustomMenusFile property of an Application or Document object.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the BuiltInMenus property. It adds a menu and menu item to the Add-ins tab and sets the menu and menu item's Caption properties.

To restore the built-in user interface in Microsoft Visio after you run this macro, call the ThisDocument.ClearCustomMenus method.

 
Public Sub BuiltInMenus_Example() 
 
 Dim vsoUIObject As Visio.UIObject 
 Dim vsoMenuSets As Visio.MenuSets 
 Dim vsoMenuSet As Visio.MenuSet 
 Dim vsoMenus As Visio.Menus 
 Dim vsoMenu As Visio.Menu 
 Dim vsoMenuItems As Visio.MenuItems 
 Dim vsoMenuItem As Visio.MenuItem 
 
 'Get a UIObject object that represents Visio built-in menus. 
 Set vsoUIObject = Visio.Application.BuiltInMenus 
 
 'Get the MenuSets collection. 
 Set vsoMenuSets = vsoUIObject.MenuSets 
 
 'Get the drawing window menu set. 
 Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing) 
 
 'Get the Menus collection. 
 Set vsoMenus = vsoMenuSet.Menus 
 
 'Add a new menu before the Window menu. 
 Set vsoMenu = vsoMenus.AddAt(7) 
 vsoMenu.Caption = "MyNewMenu" 
 
 'Get the MenuItems collection. 
 Set vsoMenuItems = vsoMenu.MenuItems 
 
 'Add a menu item to the new menu. 
 Set vsoMenuItem = vsoMenuItems.Add 
 
 'Set the Caption property for the new menu item. 
 vsoMenuItem.Caption = "&MyNewMenuItem" 
 
 'Tell Visio to use the new UI when the document is active. 
 ThisDocument.SetCustomMenus vsoUIObject 
 
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.