Change the state of a custom CommandBar button

 2000-02-05    Commandbars    0    45

The macro below shows how you can change the state of a custom CommandBar button so it displays as depressed or not.

Sub ToggleButtonState()
Dim m As CommandBarControl
    Set m = CommandBars("CommandBarName").Controls(1)
    If m.State = msoButtonDown Then
        m.State = msoButtonUp
    Else
        m.State = msoButtonDown
    End If
    Set m = Nothing
End Sub


Leave a comment:

Your comment will only be published after it has been moderated and found spam free.
Your e-mail address will only be used to display your Gravatar.