I've written many VBA macros over the use but this my first foray into modifying the ribbon with XML and running a macro with ribbon callback. I have followed the instructions for a simple example on Ron de Bruin's webpage precisely, but when I click on the newly created button I get - 'Cannot run the macro "Macro1". The macro may not be available in this workbook or all macros may be disabled." I've tried changing the macro name, specifying with the module name eg "Module1.Macro1" but nothing seems to work.
I use OfficeRibbonXEditor to write the XML which is saved in customUI14.xml in the Book1.xlsm file in the XLSTART folder.
<customUI xmlns="https://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab idMso="TabHome" >
<group id="customGroup1" label="My Group" insertAfterMso="GroupEditingExcel">
<button id="customButton1" label="Click Me" size="large"
onAction="Macro1" imageMso="HappyFace" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Validating the XML in the OfficeRibbonXEditor gives -
Custom Ul XML is well formed.
and the generated callback macro is placed in a standard module -
Sub Macro1(control As IRibbonControl)
MsgBox "Hi There"
End Sub
When Excel 2010 is started the HappyFace icon appears on the ribbon in the right place but clicking on it I get the 'Cannot run the macro...' message. I can't figure this out at all.
This is my first post so I hope I've done things correctly.