1

I need to hide the Data Validation button when user switch to particular sheet, but I cannot locate this button in Application.CommandBars.

I have tried to loop out all the CommandBar object and its control name but still not found, has anyone tried this before?

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
calendarw
  • 1,511
  • 2
  • 9
  • 18

1 Answers1

0

In Excel 2007, the Data Validation button is in the Ribbon UI (not command bars) - you won't be able to disable it without overwriting the existing Ribbon group (GroupDataTools). See this related SO post regarding how to overwrite existing Ribbon groups. To locate the Control IDs of menu groups in the Ribbon, you can download this list of control ids from Microsoft.

Community
  • 1
  • 1
SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
  • How to get the Ribbon UI control in code? I'm using VS2005 Excel project, is it able to get the object in `ThisAddIn_Startup`? – calendarw Aug 01 '12 at 02:44
  • To replace the Ribbon Group, see [this website which describes how to properly modify existing [Ribbon Groups](http://www.rondebruin.nl/xmlribbongroups.htm). You can also find [more information on the Office Fluent UI here](http://msdn.microsoft.com/en-us/office/aa905530.aspx). – SliverNinja - MSFT Aug 01 '12 at 14:17