Protection Property

Applies To

CommandBar object.

Description

Returns or sets the way the specified command bar is protected from user customization. Can be one of or a sum of the following MsoBarProtection constants: msoBarNoProtection, msoBarNoCustomize, msoBarNoResize, msoBarNoMove, msoBarNoChangeVisible, msoBarNoChangeDock, msoBarNoVerticalDock, or msoBarNoHorizontalDock. Read/write Long.

Specifics (Microsoft Access)

In Microsoft Access 97, you can use the Toolbar Properties sheet to set the various options of the Protection property that prevent or allow user customization of a menu bar, toolbar, or custom shortcut menu. Point to Toolbars on the View menu and click Customize, then click the Properties button in the Customize dialog box. Select the menu bar, toolbar, or custom shortcut menu you want in the Selected Toolbar box, and then use the Docking combo box and the Allow Customizing, Allow Resizing, Allow Moving, and Allow Showing/Hiding check boxes to set the protection you want. For custom shortcut menus, the only option that's available is Allow Customizing.

Example

This example steps through the collection of command bars to find the command bar named "Forms." If this command bar is found, the example makes it visible and protects its docking state.

foundFlag = False
For i = 1 To .CommandBars.Count
    If .CommandBars(i).Name = "Forms" Then
        .CommandBars(i).Protection = msoBarNoChangeDock
        .CommandBars(i).Visible = True
        foundFlag = True
    End If
Next
If Not foundFlag Then
    MsgBox "'Forms' command bar is not in the collection."
End If