K
KemnitzerH
Hi there.
I've got a question building custom menubars in visio 2003. I'm using the
Visio-API, generating the menubar
with "BuiltInMenus"
I've created a Visio COM-AddIn with Visio 2003 SDK using Visual Studio
(VB.NET) - it's working fine. The Menu
will be created by opening/creating a new Visio-Document. But - the problem
is: I want to build Menu and Sub-Menu
(hierarchical). The code is only creating the menu (not the submenu).
So I decided to test the code in VBA - it works! So, where is my problem.
Where is my error in the code? I'm happy
getting any kind of answer.
###################################################
Public Sub CreateMenus(ByVal visioDocument As
Microsoft.Office.Interop.Visio.Document)
Dim visioApplication As Microsoft.Office.Interop.Visio.Application
Dim visioUIObject As Microsoft.Office.Interop.Visio.UIObject
Dim visioMenuSetsObject As Microsoft.Office.Interop.Visio.MenuSets
Dim visioMenuSetObject As Microsoft.Office.Interop.Visio.MenuSet
Dim visioMenusObject As Microsoft.Office.Interop.Visio.Menus
Dim visioMenuObject As Microsoft.Office.Interop.Visio.Menu
Dim visioMenuItemsObject As Microsoft.Office.Interop.Visio.MenuItems
Dim visioMenuItemObject As Microsoft.Office.Interop.Visio.MenuItem
visioApplication = CType(visioDocument.Application, _
Microsoft.Office.Interop.Visio.Application)
If Not (visioApplication Is Nothing) Then
visioUIObject = visioApplication.BuiltInMenus
visioMenuSetsObject = visioUIObject.MenuSets
visioMenuSetObject = visioMenuSetsObject.ItemAtID _
(Microsoft.Office.Interop.Visio.VisUIObjSets.visUIObjSetDrawing)
visioMenusObject = visioMenuSetObject.Menus
visioMenuObject = visioMenusObject.AddAt(7)
visioMenuObject.Caption = "Menu"
visioMenuItemsObject = visioMenuObject.MenuItems
visioMenuItemObject = visioMenuItemsObject.Add
visioMenuItemObject.Caption = "Caption 1"
visioMenuItemObject.CmdNum =
Microsoft.Office.Interop.Visio.VisUICmds.visCmdHierarchical
visioMenuItemObject.ActionText = "Caption 1"
visioMenuItemObject.Enabled = True
visioMenuItemObject.BeginGroup = True
visioMenuItemsObject = visioMenuObject.MenuItems
visioMenuItemObject = visioMenuItemsObject.Add
visioMenuItemObject.Caption = "Submenu under Caption 1"
visioMenuItemObject.CmdNum = 0
visioMenuItemObject.AddOnName = "QUEUEMARKEREVENT"
visioMenuItemObject.AddOnArgs = GetAction("IntializeRoom",
visioDocument.Name)
visioMenuItemObject.Enabled = True
visioMenuItemObject.BeginGroup = True
visioMenuItemObject = visioMenuItemsObject.Add
visioMenuItemObject.Caption = "Submenu under Caption 1"
visioMenuItemObject.CmdNum = 0
visioMenuItemObject.AddOnName = "QUEUEMARKEREVENT"
visioMenuItemObject.AddOnArgs = GetAction("IntializeRoom",
visioDocument.Name)
visioMenuItemObject.Enabled = True
visioMenuItemObject.BeginGroup = True
visioApplication.SetCustomMenus(visioUIObject)
End If
End Sub
############################################
I've got a question building custom menubars in visio 2003. I'm using the
Visio-API, generating the menubar
with "BuiltInMenus"
I've created a Visio COM-AddIn with Visio 2003 SDK using Visual Studio
(VB.NET) - it's working fine. The Menu
will be created by opening/creating a new Visio-Document. But - the problem
is: I want to build Menu and Sub-Menu
(hierarchical). The code is only creating the menu (not the submenu).
So I decided to test the code in VBA - it works! So, where is my problem.
Where is my error in the code? I'm happy
getting any kind of answer.
###################################################
Public Sub CreateMenus(ByVal visioDocument As
Microsoft.Office.Interop.Visio.Document)
Dim visioApplication As Microsoft.Office.Interop.Visio.Application
Dim visioUIObject As Microsoft.Office.Interop.Visio.UIObject
Dim visioMenuSetsObject As Microsoft.Office.Interop.Visio.MenuSets
Dim visioMenuSetObject As Microsoft.Office.Interop.Visio.MenuSet
Dim visioMenusObject As Microsoft.Office.Interop.Visio.Menus
Dim visioMenuObject As Microsoft.Office.Interop.Visio.Menu
Dim visioMenuItemsObject As Microsoft.Office.Interop.Visio.MenuItems
Dim visioMenuItemObject As Microsoft.Office.Interop.Visio.MenuItem
visioApplication = CType(visioDocument.Application, _
Microsoft.Office.Interop.Visio.Application)
If Not (visioApplication Is Nothing) Then
visioUIObject = visioApplication.BuiltInMenus
visioMenuSetsObject = visioUIObject.MenuSets
visioMenuSetObject = visioMenuSetsObject.ItemAtID _
(Microsoft.Office.Interop.Visio.VisUIObjSets.visUIObjSetDrawing)
visioMenusObject = visioMenuSetObject.Menus
visioMenuObject = visioMenusObject.AddAt(7)
visioMenuObject.Caption = "Menu"
visioMenuItemsObject = visioMenuObject.MenuItems
visioMenuItemObject = visioMenuItemsObject.Add
visioMenuItemObject.Caption = "Caption 1"
visioMenuItemObject.CmdNum =
Microsoft.Office.Interop.Visio.VisUICmds.visCmdHierarchical
visioMenuItemObject.ActionText = "Caption 1"
visioMenuItemObject.Enabled = True
visioMenuItemObject.BeginGroup = True
visioMenuItemsObject = visioMenuObject.MenuItems
visioMenuItemObject = visioMenuItemsObject.Add
visioMenuItemObject.Caption = "Submenu under Caption 1"
visioMenuItemObject.CmdNum = 0
visioMenuItemObject.AddOnName = "QUEUEMARKEREVENT"
visioMenuItemObject.AddOnArgs = GetAction("IntializeRoom",
visioDocument.Name)
visioMenuItemObject.Enabled = True
visioMenuItemObject.BeginGroup = True
visioMenuItemObject = visioMenuItemsObject.Add
visioMenuItemObject.Caption = "Submenu under Caption 1"
visioMenuItemObject.CmdNum = 0
visioMenuItemObject.AddOnName = "QUEUEMARKEREVENT"
visioMenuItemObject.AddOnArgs = GetAction("IntializeRoom",
visioDocument.Name)
visioMenuItemObject.Enabled = True
visioMenuItemObject.BeginGroup = True
visioApplication.SetCustomMenus(visioUIObject)
End If
End Sub
############################################