M
mikeFin
Sorry for posting again. I tried finding the solution on my own and by
searching the web, but it do not see what's wrong.
When I had the following VBA code stored in the document, it did work.
Now that it is in the stencil, the menu does build, but the Menu-Item is
greyed-out.
Here is the code:
- - -
Sub new_menu()
Dim appVisio As Visio.Application
Dim UIObj As Visio.UIObject 'Contains the UI object
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
Set appVisio = Visio.Application
Set UIObj = appVisio.BuiltInMenus
Set menuSetsObj = UIObj.MenuSets
Set menuSetObj = menuSetsObj.ItemAtID(visUIObjSetDrawing)
Set menusObj = menuSetObj.Menus
Set menuObj = menusObj.AddAt(7)
menuObj.Caption = "&My Menu"
Set menuItemsObj = menuObj.MenuItems
Set menuItemObj = menuItemsObj.Add
With menuItemObj
.Caption = "&My Menu Item1"
.CmdNum = 0
.AddOnName = "myProc1"
.Enabled = True
End With
ActiveDocument.SetCustomMenus UIObj
End Sub
- - -
I guess it is because of:
.AddOnName = "myProc1"
I already tried changing it to "StencilName!moduleName.myProc1", but it
doesn't seem to help.
I hope this was the last question of that sort.
Thanks !
searching the web, but it do not see what's wrong.
When I had the following VBA code stored in the document, it did work.
Now that it is in the stencil, the menu does build, but the Menu-Item is
greyed-out.
Here is the code:
- - -
Sub new_menu()
Dim appVisio As Visio.Application
Dim UIObj As Visio.UIObject 'Contains the UI object
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
Set appVisio = Visio.Application
Set UIObj = appVisio.BuiltInMenus
Set menuSetsObj = UIObj.MenuSets
Set menuSetObj = menuSetsObj.ItemAtID(visUIObjSetDrawing)
Set menusObj = menuSetObj.Menus
Set menuObj = menusObj.AddAt(7)
menuObj.Caption = "&My Menu"
Set menuItemsObj = menuObj.MenuItems
Set menuItemObj = menuItemsObj.Add
With menuItemObj
.Caption = "&My Menu Item1"
.CmdNum = 0
.AddOnName = "myProc1"
.Enabled = True
End With
ActiveDocument.SetCustomMenus UIObj
End Sub
- - -
I guess it is because of:
.AddOnName = "myProc1"
I already tried changing it to "StencilName!moduleName.myProc1", but it
doesn't seem to help.
I hope this was the last question of that sort.
Thanks !