У меня есть Excel XML с «Office RibbonX Editor», найденный здесь:
https://github.com/fernandreu/office-ribbonx-editor/releases/tag/v1.5.1
XML:
<customUI
xmlns="http://schemas.microsoft.com/office/2009/07/customui"
xmlns:x1="ns"
onLoad="RibbononLoad">
<ribbon startFromScratch = "true">
<qat>
<sharedControls>
<control idMso="FileSaveAs" visible="true"/>
<control idMso="VisualBasic" visible="true"/>
<button idQ="Test" visible="true" imageMso="AddressBook" onAction="DoesntWork"/>
<button idQ="x1:Play" visible="true" imageMso="Info" onAction="DoesntWork2"/>
</sharedControls>
</qat>
<tabs>
<tab id="Tabb" label="Tabb" tag="Tabb">
<group id="GrupID" label="Rbbn" tag="TabbRbbn">
<button id="Work_ID1" label="Works1" imageMso="DirectRepliesTo" onAction="DoesWork"/>
<button id="Work_ID2" label="Works2" imageMso="AccountMenu" onAction="DoesWork2"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Соответствующий код VBA:
Public rib As IRibbonUI
Sub RibbononLoad(ribbon As IRibbonUI)
Set rib = ribbon
Debug.Print "Ribbon Load"
End Sub
Sub DoesntWork(control As IRibbonControl)
MsgBox "DoesntWork"
End Sub
Sub DoesntWork2(control As IRibbonControl)
MsgBox "DoesntWork2"
End Sub
Sub DoesWork(control As IRibbonControl)
MsgBox "DoesWork " & control.ID
End Sub
Sub DoesWork2(control As IRibbonControl)
MsgBox "DoesWork2 " & control.ID
End Sub
Моя проблема:
OnAction для пользовательских вкладок работает нормально.
OnAction для обоих пользовательских qat не работает. Значки появляются в Excel, но при нажатии на них ничего не происходит?