PDA

View Full Version : Dynamic Ribbon Button



shockandawe
09-14-2010, 05:58 PM
I'm trying to create an Excel Ribbon button that only shows based on certain criteria. So, for example, the button might show on my PC but not on yours (based on network userid).

I can find plenty of help on the web for creating dynamic buttons where you can programmatically assign functions and dropdowns to a button. But I cannot seem to find any help on how to create a button that, in some instances, does not show at all. Any help is appreciated.

Jan Karel Pieterse
09-14-2010, 11:25 PM
A button has a getVisible callback:

<button id="Button1" label="Button1" getVisible="Button1_GetVisible">

Then in your workbook, insert the callback code:
Private Sub Button1_GetVisible(control as IRibbonControl, ByRef returnedVal)
'To hide button:
returnedVal=False
End Sub