C# 将Excel DNA按钮连接到C代码
如何将Excel DNA功能区控件连接到C代码中的函数 我的dna库文件.dna包含一个带按钮的功能区。但我不知道如何让C代码在按下时启动。永远不会调用下面显示的OnButtonPressed函数 以下是我的CustomUI XML: 您还需要在功能区xml中设置onAction属性:C# 将Excel DNA按钮连接到C代码,c#,excel-dna,C#,Excel Dna,如何将Excel DNA功能区控件连接到C代码中的函数 我的dna库文件.dna包含一个带按钮的功能区。但我不知道如何让C代码在按下时启动。永远不会调用下面显示的OnButtonPressed函数 以下是我的CustomUI XML: 您还需要在功能区xml中设置onAction属性: <CustomUI> <customUI xmlns='http://schemas.microsoft.com/office/2009/07/customui' loadImage
<CustomUI>
<customUI xmlns='http://schemas.microsoft.com/office/2009/07/customui' loadImage='LoadImage'>
<ribbon>
<tabs>
<tab id='XLST_Tab' label='XLST'>
<group id='XLST_Group' label='Standard Time'>
<button id='BigBtn' label='Press Me' size='large' />
<button id='BigBtn2' label='Press This Too' size='large' />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
</CustomUI>
namespace XLST
{
[ComVisible(true)]
public class XLSTRibbon : ExcelRibbon
{
public void OnButtonPressed(IRibbonControl control)
{
MessageBox.Show("Hello from control " + control.Id);
}
}
}