Hi guys,
I’m not sure if this can be done, but I am trying to create two toggle buttons in a custom ribbon tab and make it such that:
1. When toggle button 1 is pressed, toggle button 2 is switched off
2. When toggle button 2 is pressed toggle button 1 button is switched off and so forth
My code is below and im using invalidatecontrol method to reset a button to the off state when the other is pressed.
Is there a simple way of getting this to work?
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab" label="Custom Tab">
<group id="customGroup" label="Custom Group">
<toggleButton id="customButton1" label="Face 1" imageMso="HappyFace" size="large" onAction="Callback1" />
<toggleButton id="customButton2" label="Face 2" imageMso="HappyFace" size="large" onAction="Callback2" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Dim PressedState As Boolean
Public gobjRibbon As IRibbonUI
Public Sub OnRibbonLoad(objRibbon As IRibbonUI)
Set gobjRibbon = objRibbon
End Sub
Sub callback1(control As IRibbonControl, pressed As Boolean)
MsgBox "Face 1 on - Face 2 off"
gobjRibbon.InvalidateControl ("customButton2")
End Sub
Sub callback2(control As IRibbonControl, pressed As Boolean)
MsgBox "Face 2 on - Face 1 off"
gobjRibbon.InvalidateControl ("customButton1")
End Sub
Is there a simple way of getting this to work?
Thanks.