Answered Table context menu in Excel

  • Thursday, June 28, 2012 1:45 PM
     
      Has Code

    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




All Replies