Howto: Add item to Visio 2003 share menu

C

Chris Roth [ Visio MVP ]

What kind of things do you want to do with the menu?

There are two routes: use the ShapeSheet and add an Actions section, or use
the Visio UIObject model for modifying the menu via code.

--

Hope this helps,

Chris Roth
Visio MVP
 
T

Tamir Khason

I want to add my custom items to Connector(Document, Shape, etc) So I'm
using
//Get a UIObject object that represents Microsoft Office Visio built-in
menus.

Visio.UIObject obj = VisApp.BuiltInMenus;


//Get the MenuSet s collection.

Visio.MenuSets mss = obj.MenuSets;


//Get the drawing window menu set.

short itmid = (short)Visio.VisUIObjSets.visUIObjSetDrawing;

Visio.MenuSet ms = mss.get_ItemAtID(itmid);


//Get the Menus collection.

Visio.Menus menus = ms.Menus;


//Add a new menu before the Window menu.

Visio.Menu mnu = menus.AddAt(7);

mnu.Caption = "TEST";


//Get the MenuItems collection.

Visio.MenuItems mitems = mnu.MenuItems;


//Add a menu item to the new menu.

Visio.MenuItem item = mitems.Add();


//Set the Caption property for the new menu item.

item.Caption = "&TestCaption";


//VisDocument.CustomMenus mnus = obj;

//Tell Visio to use the new UI when the document is active.

VisDocument.SetCustomMenus(obj);

But nothing happens all menus are regular without any new items there. Where
is my problem?


--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
 

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