Priority Property

Applies To

CommandBarButton object, CommandBarComboBox object, CommandBarControl object, CommandBarPopup object.

Description

Returns or sets the priority of the specified command bar control. A control's priority determines whether it can be dropped from a docked command bar if the command bar controls don't fit in a single row. Read/write Long.

Remarks

A priority of 1 means the control cannot be dropped. Controls with the highest priority numbers are dropped first.

A priority of 0 indicates an "automatic" value, which will choose an effective priority based on the control type. A priority of 1 means that the control will never be dropped. The other valid priorities are from 2 through 7, and these controls will be dropped in order of their values (starting with the highest values).

Example

This example moves the first combo box control from the custom command bar named "Custom" to the position before the seventh control on the command bar, sets the tag to "selection box," and then assigns the control a high priority so that it will likely be dropped from the command bar if the controls don't all fit in one row.

Set allcontrols = CommandBars("Custom").Controls
For Each ctrl In allControls
    If ctrl.Type = msoControlComboBox Then
        With ctrl
            .Move Before:=7
            .Tag = "Selection box"
            .Priority = 5
        End With
    Exit For
End If
Next