how to get and change the context menu of master edit in code

J

Jack Franklin

Hi, everyone,

When we right click the masters in the stencil, we get a context menu. My
question is that how can I get that menu and add some cusom menuitem to that?

Thank you very much!
 
J

JuneTheSecond

Hi,

VisUIObjSets.visUIObjSetCntx_DrawObjSel
might be proper argument in the
uiObj.MenuSets.ItemAtID property.
for example

Public Sub CreateShortCutMenu()
Dim uiObj As Visio.UIObject
Dim menuSetObj As Visio.MenuSet
Dim menuObj As Visio.Menu
Dim menuItemObj As Visio.MenuItem

Set uiObj = Visio.Application.BuiltInMenus
Set menuSetObj =
uiObj.MenuSets.ItemAtID(VisUIObjSets.visUIObjSetCntx_DrawObjSel)
Set menuObj = menuSetObj.Menus(0)
Set menuItemObj = menuObj.MenuItems.AddAt(1)

menuItemObj.Caption = "UIObject Context Menu"
menuItemObj.CmdNum = 0
menuItemObj.AddOnName = "thisdocument.Macro1"

ThisDocument.SetCustomMenus uiObj
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top