我有一个xlam文件,我想在其中添加一个自定义的ribbonX按钮。
我使用自定义用户界面编辑器和这个xml,它“工作”。
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="Tab1" label="LeaveReport">
<group id="Group1" label="Formatering">
<button id="Button1" imageMso="ChartSwitchRowColumn" size="large"/ >
</group>
</tab>
</tabs>
</ribbon>
</customUI>但是如果我添加onaction来让按钮做一些事情,它根本不会加载。这意味着标签和按钮根本不在那里。
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="Tab1" label="LeaveReport">
<group id="Group1" label="Formatering">
<button id="Button1" imageMso="ChartSwitchRowColumn" size="large"/ onAction="formatera_for_pivot_tabell()"/ >
</group>
</tab>
</tabs>
</ribbon>
</customUI>我也在没有()的情况下尝试过。
我在这里做错了什么?一个没有动作的按钮是非常无用的:-/
发布于 2018-05-28 07:43:47
要使您的自定义ribbon UI正常工作,您必须:
应该更新onAction="formatera_for_pivot_tabell"
在代码隐藏文件中执行xmlns="http://schemas.microsoft.com/office/2009/07/customui"
- C#: `void OnAction(IRibbonControl control)`
- VBA: `Sub OnAction(control As IRibbonControl)`
- C++: `HRESULT OnAction([in] IRibbonControl *pControl)`
- Visual Basic: `Sub OnAction(control As IRibbonControl)`
它应该有以下文章中指定的签名:
https://stackoverflow.com/questions/46520689
复制相似问题