R
Rad
Hi,
I have replaced this string "RS_Visio_Script.NewMacros.RerunPSIT" with
"MyMacro"
at vsoMenuItem.AddOnName = "MyMacro" (See below), which made the macro not
work.
Does any one know what I need to do to make an outside macro, located in a
Stencil, work? The code below works and calls MyMacro macro if it’s in the
Active document, but does not work if the macro in a Stencil.
Thanks,
Rad
Public Sub AddAt_Example()
Dim vsoUI 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 UI object that represents Microsoft Office Visio built-in menus.
Set vsoUI = Visio.Application.BuiltInMenus
'Get the MenuSets collection.
Set vsoMenuSets = vsoUI.MenuSets
'Get the drawing window menu set.
Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)
'Get the Menus collection.
Set vsoMenus = vsoMenuSet.Menus
'Add a Demo menu before the Window menu.
Set vsoMenu = vsoMenus.AddAt(7)
vsoMenu.Caption = "Demo"
'Get the MenuItems collection.
Set vsoMenuItems = vsoMenu.MenuItems
'Add a menu item to the new Demo menu.
Set vsoMenuItem = vsoMenuItems.Add
'Set the properties for the new menu item.
vsoMenuItem.Caption = "Run & MyMacro"
vsoMenuItem.AddOnName = "MyMacro"
vsoMenuItem.ActionText = "Run MyMacro"
'Tell Visio to use the new UI when the document is active.
ThisDocument.SetCustomMenus vsoUI
End Sub
I have replaced this string "RS_Visio_Script.NewMacros.RerunPSIT" with
"MyMacro"
at vsoMenuItem.AddOnName = "MyMacro" (See below), which made the macro not
work.
Does any one know what I need to do to make an outside macro, located in a
Stencil, work? The code below works and calls MyMacro macro if it’s in the
Active document, but does not work if the macro in a Stencil.
Thanks,
Rad
Public Sub AddAt_Example()
Dim vsoUI 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 UI object that represents Microsoft Office Visio built-in menus.
Set vsoUI = Visio.Application.BuiltInMenus
'Get the MenuSets collection.
Set vsoMenuSets = vsoUI.MenuSets
'Get the drawing window menu set.
Set vsoMenuSet = vsoMenuSets.ItemAtID(visUIObjSetDrawing)
'Get the Menus collection.
Set vsoMenus = vsoMenuSet.Menus
'Add a Demo menu before the Window menu.
Set vsoMenu = vsoMenus.AddAt(7)
vsoMenu.Caption = "Demo"
'Get the MenuItems collection.
Set vsoMenuItems = vsoMenu.MenuItems
'Add a menu item to the new Demo menu.
Set vsoMenuItem = vsoMenuItems.Add
'Set the properties for the new menu item.
vsoMenuItem.Caption = "Run & MyMacro"
vsoMenuItem.AddOnName = "MyMacro"
vsoMenuItem.ActionText = "Run MyMacro"
'Tell Visio to use the new UI when the document is active.
ThisDocument.SetCustomMenus vsoUI
End Sub