Making Custom Toolbar Buttons Look Pressed

If a toolbar button represents an option with two possible states, you can change the appearance of the toolbar button to indicate the current state of the option: When the option is turned on, the associated button looks pressed; when the option is turned off, the button looks raised. This is analagous to placing or removing a check mark next to a menu item.

The Pushed property for a toolbar button is True if the button appears pressed, and it's False if the button doesn't appear pressed. For example, the following procedure, assigned to a new Database View toolbar button, changes the appearance of the toolbar button before switching between special views on the worksheet.


Sub DatabaseView()
    With Toolbars("MyAppToolbar").ToolbarButtons(3)
        .Pushed = Not .Pushed
        If .Pushed Then
            'Switch to database view
            .
            .
            .
        Else
            'Switch to worksheet view
            .
            .
            .
        End If
    End With
End Sub