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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top