Disable ribbon buttons when Excel is Busy

Add-in Express™ Support Service
That's what is more important than anything else

Disable ribbon buttons when Excel is Busy
 
gjvdkamp




Posts: 56
Joined: 2018-08-28
Hi,

When I select a normal Excel ribbon like Insert and start editing a cell, all the buttons on that ribbon disable because Excel is busy.

Is there any way to get my custom ADX ribbon to behave the same way? Right now when a user clicks I check if Excel is busy and show a messagebox instead but a better UX would be to disable all buttons that have to call into the Excel objectmodel.

There doesn't seem to be an event that I can respond to that toggles busy/ not busy or settings on buttons to that effect, just double checking.
Posted 03 May, 2022 02:33:12 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Gert-Jan,

You can choose a Ribbon control that gets disabled in the context in which you want your button to be disabled. Then handle the CommandBars.Update event - it is mapped to the CommandBarsUpdate event of the Excel Events component. In the event handler you check the enabled state of the control chosen: pass the chosen control's IdMso to CommandBars.GetEnabledMso().

Also, check section How to find the Id of a built-in Ribbon control; see the PDF file in the folder {Add-in Express}\Docs on your development PC.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 05 May, 2022 07:52:48 Top
gjvdkamp




Posts: 56
Joined: 2018-08-28
Clever stuff, thank you Andrei.
Posted 05 May, 2022 07:58:50 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Welcome!

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 06 May, 2022 02:48:23 Top