Modifying the Existing UI
Here is a skeleton code framework for modifying existing menus:
Public Sub MakeWeeChange() Dim UIObj As Visio.UIObject Set UIObj = Visio.Application.BuiltInMenus ' <make modifications> Visio.Application.SetCustomMenus UIObj End Sub
It is important that you do not forget to use the SetCustomMenus method of the application object. Failing to do so will fail to activate your changes.
Listing 19.1 is a full code example of adding a “demo” menu to the existing menu sets for the current diagram. The menu item runs a VB add-on called DispName.EXE.
Listing 19.1. Adding a Menu to Visio
Sub AddAWeeDemoMenu() Dim appVisio As Visio.Application Dim UIObj As Visio.UIObject 'Contains the UI object Dim menuSetsObj As Visio.MenuSets ... |
Get Professional Development with Visio® 2000 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.