none
Table context menu in Excel RRS feed

  • Question

  • Hello,

    How to define a Table context menu with the Microsoft.Office.Core.Commandbars object in a VSTO Excel application addin (for Excel 2007 and 2010) in VB.NET

    For a Cell Context menu, Row Context menu  and a Column Context menu the defination is :

     Friend CellContextMenu As CommandBar = Globals.ThisAddIn.Application.CommandBars("Cell")
      Friend RowContextMenu As CommandBar = Globals.ThisAddIn.Application.CommandBars("Row")
      Friend ColumnContextMenu As CommandBar = Globals.ThisAddIn.Application.CommandBars("Column")

    I tried the following, but it is incorrect, the VS2010 compiler raise an exception:

    Friend TableContextMenu As CommandBar = Globals.ThisAddIn.Application.CommandBars("Table")

    or

    Friend TableContextMenu As CommandBar = Globals.ThisAddIn.Application.CommandBars("ListRange")

    With the Microsoft Office 2010 context menus Add-in you get the names of the context menu's when you right-click for a context menu. the name appears in the context menu at the bottem

    the name of the Table context menu in Office 2010 is "ContextMenuListRange"

    This name I find also in de List of ControlIDs for Excel 2010 : Office 2010 Help Files: Office Fluent User Interface Control Identifiers

    but not in the list of ControlId's for Excel 2007 : 2007 Office System Document: Lists of Control IDs

    This website Customizing Context Menus in All Versions of Microsoft Excel mentions the Cell context menus and the Row context menu and Column context menu.

    What is the correct argument for the Commandbars object to define a Table context menu.

    Best Regards,

    Emile Lambour




    Thursday, June 28, 2012 1:45 PM

Answers

  • Quist Zhang is wrong, the answer is that, at least with Excel 2007, you are looking for:
    Application.CommandBars("List Range Popup")

    • Proposed as answer by bpeikes Wednesday, October 24, 2012 4:15 PM
    • Marked as answer by Quist ZhangModerator Wednesday, October 24, 2012 5:21 PM
    Wednesday, October 24, 2012 4:15 PM

All replies

  • Hi Emile,

    Thank you for posting in the MSDN Forum.

    It based on my experience that Table Context Menu is not exist. Are you sure that you've seen that before? As you mentioned that you have referred to the tutorial of Customizing Context Menus in All Versions of Microsoft Excel, I think if Table Context Menu exists, it should have been mentioned in that tutorial.

    Hope it helps.

    Best regards,
    Quist

    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, July 3, 2012 2:53 AM
    Moderator
  • Quist Zhang is wrong, the answer is that, at least with Excel 2007, you are looking for:
    Application.CommandBars("List Range Popup")

    • Proposed as answer by bpeikes Wednesday, October 24, 2012 4:15 PM
    • Marked as answer by Quist ZhangModerator Wednesday, October 24, 2012 5:21 PM
    Wednesday, October 24, 2012 4:15 PM
  • Hi Bpeikes,

    Thank you very much for correcting my mistakes. It's really a big help.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 24, 2012 5:29 PM
    Moderator