Enable/Disable 功能区按钮基于 Excel Sheet 更改 - VSTO
Enable/Disable Ribbon button based on Excel Sheet Change - VSTO
我编写了一个 VSTO Excel 应用程序,我正在尝试根据所选工作表更改按钮行为。该事件实际上是在 ThisWorkbook.cs
class 中引发的,功能区按钮只能在 Ribbon.cs class 中访问。
有什么方法可以在 ThisWorkbook.cs class 中启用或禁用功能区按钮,而无需在 ThisWorkbook.cs
class 中创建功能区实例?
void ThisWorkbook_SheetActivate(object Sh)
{
if (SomeCondition)
{
//Enable button
}
else
{
//Disable button
}
}
您可以通过Ribbon ribon = Globals.Ribbons.Ribbon;
访问功能区
我编写了一个 VSTO Excel 应用程序,我正在尝试根据所选工作表更改按钮行为。该事件实际上是在 ThisWorkbook.cs
class 中引发的,功能区按钮只能在 Ribbon.cs class 中访问。
有什么方法可以在 ThisWorkbook.cs class 中启用或禁用功能区按钮,而无需在 ThisWorkbook.cs
class 中创建功能区实例?
void ThisWorkbook_SheetActivate(object Sh)
{
if (SomeCondition)
{
//Enable button
}
else
{
//Disable button
}
}
您可以通过Ribbon ribon = Globals.Ribbons.Ribbon;