Opening the context-menu by right-clicking on a blank Page?

Started by MaxKasparek, April 09, 2013, 03:57:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MaxKasparek

Hey Guys,

as you can see, by reading the topic, i have Problems with the context-menus under Visio2010. With Visio 2003 and 2007 everything works fine and i never needed to change my code. But since 2010 the customized context menu isnt included in the context menu when i right-click on a blank Page. When i right-click on a shape, it doesnt matter on which one, it works on alll of them, the context menu looks like i want it to.

Is there any way to solve this Problem? When i start from zero and programm it via fluentUI like the Ribbon it wont change a thing, would it?

Here the import parts of the code:

   
    Set DrawingDoc = ActiveDocument
    Set vsoUIObject = DrawingDoc.Application.BuiltInMenus
    Set vsoMenuSetsObj = vsoUIObject.MenuSets
    Set vsoMenuSetObj = vsoMenuSetsObj.ItemAtID(visUIObjSetCntx_DrawObjSel)
   
    Set vsoMenusObj = vsoMenuSetObj.Menus
    Set vsoMenuObj = vsoMenusObj(0)
    Set vsoMenuItemsObj = vsoMenuObj.MenuItems
   
    Call Modul_Toolbar.create_Pagemenu(vsoMenuItemsObj)


Example for what happens in create_Pagemenu:


        Set vsoMenuItemObj = vsoMenuItemsObj.AddAt(0)
        vsoMenuItemObj.Caption = Shape_UEbersicht_D
        vsoMenuItemObj.AddOnName = "ThisDocument.statistik"
        vsoMenuItemObj.TypeSpecific1 = visIconIXDRAWINGEXPLORER


I hope this is enough for you to understand the way i create my context-menu.

i appreciate any help,
bye,
Max

JuneTheSecond

#1
I think visUIObjSetCntx_Page would have been better than visUIObjSetCntx_DrawObjSel.
ThisDocument.SetCustomMenus vsoUIObject is needed at the last of main program.
vsoMenuItemObj.Caption = "Shape_UEbersicht_D" in create_Pagemenu
should be vsoMenuItemObj.Caption = "Shape_UEbersicht_D".
Your macro worked well, when I replaced them.

And my recomendation is to declare all Visio objects like
    Dim DrawingDoc As Visio.Document
    Dim vsoUIObject As Visio.UIObject
    ........
    ........

with the first statement "Option Explicit" at the top of every module
to help you from easy mistakes.

Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

Best Regards,

Junichi Yoda
http://june.minibird.jp/