2015-11-19 195 views
0

我增加了一些新的“按钮”的Excel 2007中的工具栏Excel的工具栏按钮

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> 
<ribbon> 
    <tabs> 
     <tab id="customTab" label="ClaroTech"> 
      <group id="customGroup" label="Animalcare Group"> 

<button id="customButton1" label="Custom Button1" imageMso="SmartArtChangeColorsGallery" size="large" onAction="Callback1" /> 
<button id="customButton2" label="Custom Button2" imageMso="SmartArtChangeColorsGallery" size="large" onAction="Callback2" /> 
      </group> 
     </tab> 
    </tabs> 
</ribbon> 

能正常工作和工具栏显示。当按下按钮,然后我收到以下错误enter image description here

我不知道是什么原因造成这个错误,感谢所有帮助我加入以下代码到片模块之一

Sub Callback2() 
MsgBox "Welcome" 
End Sub 

回答

2

这不是一个有效的按钮回调签名。它应该是:

Sub Callback2(control As IRibbonControl) 
MsgBox "Welcome" 
End Sub 

如果使用CustomUI编辑器,它可以为您生成回调存根。