I am following How to add a custom Ribbon tab using VBA?.
I am attempting by pressing a button in the ribbon named "Leave" to turn all selected cells red.
I created a custom ribbon button using Office RibbonX Editor to the file, and get the pop up "Custom UI XML is well formed".
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab idMso="TabAddIns">
<group id="Leave" label="Leave">
<button id="LeaveButton" label="Leave" onAction="Leave"
imageMso="BeachUmbrella" size="large"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I added the following code to my Excel document.
Sub Leave()
MsgBox "Leave button clicked!"
Selection.Interior.Color = RGB(255, 0, 0)
End Sub
After selecting a few cells, and clicking the button I get:
I am using Professional Plus 2021.
I made numerous files, restarted the computer.