Dim myRibbon As IRibbonUI, PressedState As Boolean
Public MyTag$
Sub GE(control As IRibbonControl, ByRef Enabled)
If MyTag = "Enable" Then
Enabled = True
Else
If control.Tag Like MyTag Then
Enabled = True
Else
Enabled = False
End If
End If
End Sub
Sub RefreshRibbon(Tag$)
MyTag = Tag
If myRibbon Is Nothing Then
MsgBox "Error, Save/Restart your workbook" & vbNewLine & _
"Visit this page for a solution: http://www.rondebruin.nl/ribbonstate.htm"
Else
myRibbon.Invalidate
End If
End Sub
Sub Ribb******ed(ribbon As IRibbonUI)
Set myRibbon = ribbon
PressedState = False
End Sub
Sub Macro1(control As IRibbonControl, pressed As Boolean)
Select Case pressed
Case True
PressedState = True
RefreshRibbon "*"
Case False
PressedState = False
RefreshRibbon "ToggleButton1"
End Select
myRibbon.InvalidateControl "ToggleButton1"
myRibbon.InvalidateControl "G1B1"
myRibbon.InvalidateControl "G1B2"
End Sub
Sub GetImage(control As IRibbonControl, ByRef image)
Select Case control.ID
Case "ToggleButton1"
Select Case PressedState
Case True: image = "HappyFace"
Case False: image = "SadFace"
End Select
End Select
End Sub
Sub GetLabel(ByVal control As IRibbonControl, ByRef label)
Select Case control.ID
Case "ToggleButton1"
Select Case PressedState
Case True: label = "Happy"
Case False: label = "Sad"
End Select
End Select
End Sub