Context Menu Customization using VBA RRS feed

  • Question

  • Hello

    I'm trying to customize MS Project context menus using VBA.

    I know that one way to do that is to use Visual Studio Add-Ins, but since I work in a large organization VBA seams much easier to distribute to the users. (Enterprise Global - MS Project Server)

    I know that it is possible to achieve something similar in Excel 2010 using: Application.CommandBars("Cell").Controls.Add

    On the list of Project contextMenu controls I can see "ContextMenuTaskCell", "ContextMenuResourceCell","ContextMenuGanttChartBar" ...

    but Application.CommandBars("ContextMenuTaskCell").Controls.Add does not work for me.

    Below code gives me "Invalid procedure or argument" error:

    Sub AddToMenu()    

    Dim ContextMenu As CommandBar

        Set ContextMenu = Application.CommandBars("ContextMenuTaskCell")

        With ContextMenu.Controls.Add(Type:=msoControlButton, before:=2)
            .OnAction = ""
            .FaceId = 59
            .Caption = "Test"
            .Tag = "Test"
        End With
    End Sub

    Is customizing the context menu using VBA possible? 



    • Edited by Tomek_S Monday, March 4, 2013 2:39 PM
    Monday, March 4, 2013 2:37 PM

All replies