CommandBarButton State

I

ianc

I have been trying to change the state of a button so it toggles from a
pressed down state (msoButtonDown) and Up State (msoButtonUp).

However, everytime I try and set the state as below I get an error message.
Can do same thing in Excel with no such problem.

anyone any clues how to make a button toggle, or fix this code?

many thanks,

//ian

'-----------------
' Test code below
'
Dim Btn As Office.CommandBarButton

Set CmdBar = Application.CommandBars("Test")
Set Btn = CmdBar.Controls("Button A")

If Btn.State = msoButtonUp Then
Btn.State = msoButtonDown ' *** ERROR HERE ***
Else
Btn.State = msoButtonUp ' *** and ERROR HERE ***
End If
 
Top