C
calvinX
Hi Everyone,
I am having a problem with a custom menu that I was using in the non-MS
version of Visio 2000 that no longer works in Visio 2002 (or ms visio 2000).
The menu appears but it is greyed out. This code is located in my stencil,
but I tried moving it to "ThisDocument" and it still does not work.
Perhaps someone knows where I can get some resources on the internet or how
to fix this problem.
Thanks,
CalvinX
MY CODE:
Public Sub AddCustomMenu()
On Error Resume Next
'Attach new menu to Visio.
Dim uiObj As Visio.UIObject 'contains the UI object for
this instance of Visio
Dim MenuSetsObj As Visio.MenuSets 'MenuSets collection
Dim MenuSetObj As Visio.MenuSet 'A MenuSet object
Dim MenusObj As Visio.Menus 'Menus collection
Dim MenuObj As Visio.Menu 'A Menu object
Dim MenuItemsObj As Visio.MenuItems 'MenuItems collection
Dim MenuItemObj As Visio.MenuItem 'A MenuItem object
Dim strMenuAction As String
Set uiObj = Visio.Application.BuiltInMenus
Set MenuSetsObj = uiObj.MenuSets
Set MenuSetObj = MenuSetsObj.ItemAtID(visUIObjSetDrawing)
'Put a single menu into this set, with caption "&Special"
Set MenusObj = MenuSetObj.Menus
Set MenuObj = MenusObj.Add
MenuObj.Caption = "&Special"
Set MenuItemsObj = MenuObj.MenuItems
Set MenuItemObj = MenuItemsObj.Add
MenuItemObj.Caption = "Fill Point &List"
strMenuAction = "stencilDoc.Documentation.Point_List_Fill"
MenuItemObj.AddOnName = strMenuAction
MenuItemObj.MiniHelp = "Fill selected points list"
MenuItemObj.ActionText = "Fill selected points list"
'<<<<<<<<<SEPERATOR
Set MenuItemObj = MenuItemsObj.Add
MenuItemObj.CmdNum = 0
'<<<<<<<<<VERIFY LAYERS
Set MenuItemsObj = MenuObj.MenuItems
Set MenuItemObj = MenuItemsObj.Add
MenuItemObj.Caption = "&Verify Document Layers"
strMenuAction = "stencilDoc.Custom_Functions.Verify_Page_Layers"
MenuItemObj.AddOnName = strMenuAction
MenuItemObj.MiniHelp = "Verify correct layers are present on each page"
MenuItemObj.ActionText = "Verify correct layers are present on each
page"
'Change the current menus to the custom one
Visio.Application.SetCustomMenus uiObj
End Sub
I am having a problem with a custom menu that I was using in the non-MS
version of Visio 2000 that no longer works in Visio 2002 (or ms visio 2000).
The menu appears but it is greyed out. This code is located in my stencil,
but I tried moving it to "ThisDocument" and it still does not work.
Perhaps someone knows where I can get some resources on the internet or how
to fix this problem.
Thanks,
CalvinX
MY CODE:
Public Sub AddCustomMenu()
On Error Resume Next
'Attach new menu to Visio.
Dim uiObj As Visio.UIObject 'contains the UI object for
this instance of Visio
Dim MenuSetsObj As Visio.MenuSets 'MenuSets collection
Dim MenuSetObj As Visio.MenuSet 'A MenuSet object
Dim MenusObj As Visio.Menus 'Menus collection
Dim MenuObj As Visio.Menu 'A Menu object
Dim MenuItemsObj As Visio.MenuItems 'MenuItems collection
Dim MenuItemObj As Visio.MenuItem 'A MenuItem object
Dim strMenuAction As String
Set uiObj = Visio.Application.BuiltInMenus
Set MenuSetsObj = uiObj.MenuSets
Set MenuSetObj = MenuSetsObj.ItemAtID(visUIObjSetDrawing)
'Put a single menu into this set, with caption "&Special"
Set MenusObj = MenuSetObj.Menus
Set MenuObj = MenusObj.Add
MenuObj.Caption = "&Special"
Set MenuItemsObj = MenuObj.MenuItems
Set MenuItemObj = MenuItemsObj.Add
MenuItemObj.Caption = "Fill Point &List"
strMenuAction = "stencilDoc.Documentation.Point_List_Fill"
MenuItemObj.AddOnName = strMenuAction
MenuItemObj.MiniHelp = "Fill selected points list"
MenuItemObj.ActionText = "Fill selected points list"
'<<<<<<<<<SEPERATOR
Set MenuItemObj = MenuItemsObj.Add
MenuItemObj.CmdNum = 0
'<<<<<<<<<VERIFY LAYERS
Set MenuItemsObj = MenuObj.MenuItems
Set MenuItemObj = MenuItemsObj.Add
MenuItemObj.Caption = "&Verify Document Layers"
strMenuAction = "stencilDoc.Custom_Functions.Verify_Page_Layers"
MenuItemObj.AddOnName = strMenuAction
MenuItemObj.MiniHelp = "Verify correct layers are present on each page"
MenuItemObj.ActionText = "Verify correct layers are present on each
page"
'Change the current menus to the custom one
Visio.Application.SetCustomMenus uiObj
End Sub