Is it possible to set an excel 2010 built in RibbonButton to enabled=false from an excel VSTO Add-In?
I tried the following:
CommandBarControls controlls=Globals.ThisAddIn.Application.CommandBars.FindControls(MsoControlType.msoControlButton, 7374, null, false);
/// 7374 is the office control id of the control I want to access
foreach (CommandBarControl control in controlls)
{
control.Enabled = false;
}
But this seems to work only for the right click context menu. And not for the ribbon buttons.
You can only disable tabs, not controls unless you use the startFromScratch Ribbon UI attribute. See MSDN for reference.
Also see Ribbon XML FAQ for good resources on Excel Ribbon manipulation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With