State Property

Applies To

CommandBarButton object.

Description

Returns or sets the appearance of the specified command bar button control. Can be one of the following MsoButtonState constants: msoButtonUp, msoButtonDown, or msoButtonMixed. Read/write Long.

Specifics (Microsoft Access)

You can use the State property to place or remove a check beside a menu item or command button. This property replaces the functionality supplied by the SetMenuItem action and SetMenuItem method in Microsoft Access 95.

Example

This example determines whether the first control on the command bar named "Custom" has a built-in button face. If it does, the example copies the button face to the Clipboard so that it can be customized with an application such as Microsoft Paint. The example then sets the button state to msoButtonUp.

Set myControl = CommandBars("Custom").Controls(1)
With myControl
    If .BuiltInFace = True Then
        .CopyFace
    End If
    .State = msoButtonUp
End With