Custom Ribbon Question - How to change Icon with VBA?

bnj1776

Board Regular
Joined
Aug 20, 2014
Messages
67
While testing I'm often switching between EnableEvents True/False so I've added a button to the DEVELOPER tab.
Group is "Enable Events"
Yellow Smile as icon
Label is "Click to Flip"
So it ends up reading as "Click to Flip Enable Events"

This calls myEnableEvents module in my Personal.xlsb:
Code:
Sub myEnableEvents()    
    Application.EnableEvents = Application.EnableEvents = False
    Application.ScreenUpdating = Application.EnableEvents
    Debug.Print Now() & " Enable Events = " & UCase(Application.EnableEvents)
End Sub

I'd like to get rid of the debug message and replace it with a change to the icon.
For example:
True = Yellow Smile (existing icon)
False = Unpainted Smile (existing icon)

This may seem silly, but the code I've found for dealing with the ribbon is not looking like VBA code.
For example: Images on Custom Ribbon controls in Excel 2007-2013

Would someone please explain what that odd looking code is about (and what language) and/or tell me how to do this with VBA please?

Thanks
 
Am no expert in ribbon customization but i sure know that language)in the link) is XML. And i am almost certain you can;t do what you want with VBA

There's also a small app - Custom UI editor which can be used to customise the office ribbon(using XML). Am sure you can get more info from ron de bruin's site(the same site from which you got that link)
 
Upvote 0
no expert but have had a play with custom ribbons

i think you would have to set activate and deactivate setting but may need two buttons

one = on and in focus sets the other button = off to greyed out and vice verso

cant help with how sorry but might help in you seeking solution
 
Upvote 0
You can use the getImage callback, which is inserted into the XML in place of the image or imageMso items. This references a VBA procedure that determines what image should be displayed.

See this page for information: Ribbon Images & Labels Part I.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top