It is well documented how built-in ribbon buttons in Microsoft Office can be repurposed (here for instance), e.g. the Copy button. However, I am not aware of any method to take full control of the enabled state of repurposed built-in controls. For me this poses a problem since I would like to implement some extended functionality in Excel and PowerPoint for which in some cases the alignment buttons make sense. But they are disabled by Excel/PowerPoint so repurposing them does not work.
Disabling built-in button that would be enabled by default is not a problem. Defining a getEnabled callback for the built-in button seems to do the trick - problem solved.
But how to enable built-in ribbon button that would be disabled by default? (getEnabled does not help here)
I suspect there is no "VBA/VSTO way" to accomplish the task? Do you think it would be possible using COM, e.g. via IAccessible? So far I have only found ways to enumerate, select and invoke the button commands but not to change their state.