VBA Code:
Private Sub ToggleButton1_Click()
If IsNull(Me.ToggleButton1.Value) Then
Me.ToggleButton1.Caption = "Pending"
Me.ToggleButton1.BackColor = Me.BackColor
ElseIf ToggleButton1.Value = True Then
Me.ToggleButton1.Caption = "Done"
Me.ToggleButton1.BackColor = rgbGreen
ElseIf Me.ToggleButton1.Value = False Then
Me.ToggleButton1.Caption = "Waived"
Me.ToggleButton1.BackColor = rgbMediumPurple
End If
End Sub
VBA Code:
Private Sub UserForm_Initialize()
Me.ToggleButton1.Value = Null
End Sub
The toggle button's caption is not getting reflected as "Pending" when the value is "Null".
When I launch the form the togglebutton value is Null and I see the caption as "pending" as shown in below picture.
Like this: (But this same caption is not coming again once I click on the toggle button)
then when I click the button,
the button turns green and caption becomes "Done" -- 1st button in below picture.
On clicking again,
the button turns purple and caption becomes "Waived" -- 2nd button in below picture.
On clicking again,
neither the color nor the caption changes. Just the color gets dim (which I believe is for null value) -- 3rd button in below picture
If I keep pressing the toggle button, it keeps toggling between the below given 3 figures.
How can I get the toggle button to look as above i.e. caption : Pending & backcolor : me.backcolor
Any help is highly appreciated.
Last edited: