Priority Property

Microsoft Office Visual Basic

ShowAs it applies to the CommandBarButton, CommandBarComboBox, and CommandBarControl objects.

Returns or sets the priority of a command bar control. A control's priority determines whether the control can be dropped from a docked command bar if the command bar controls can't fit in a single row. Controls that can't fit in a single row drop off command bars from right to left. Read/write Long.

Remarks

Valid priority numbers are 0 (zero) through 7 and the default value is 3. A priority of 1 means that the control cannot be dropped from a toolbar. Other priority values are ignored.

The Priority property is not used by command bar controls that are menu items.

ShowAs it applies to the SharedWorkspaceTask object.

Returns or sets the status of the specified shared workspace task. Read/write msoSharedWorkspaceTaskPriority.

MsoSharedWorkspaceTaskPriority can be one of the following msoSharedWorkspaceTaskPriority constants.
msoSharedWorkspaceTaskPriorityHigh (1)
msoSharedWorkspaceTaskPriorityLow (3)
msoSharedWorkspaceTaskPriorityNormal (2)

expression.Priority

expression    Required. An expression that returns a SharedWorkspaceTask object.

Remarks

The shared workspace task schema on the server can be customized. Customization of the schema may affect the task priority enumeration when the Add or Save method is called. Priority property values are mapped as follows:

  • Downloaded value 1 is mapped to msoSharedWorkspaceTaskPriority 1 (msoSharedWorkspaceTaskPriorityHigh). Downloaded values 2 through N-1 are mapped to msoSharedWorkspaceTaskPriority 2 (msoSharedWorkspaceTaskPriorityNormal). Downloaded value N is mapped to msoSharedWorkspaceTaskPriority 3 (msoSharedWorkspaceTaskPriorityLow).
  • Uploaded enumeration values 1 through 3 are mapped to schema values 1 through 3. If a user-specified value does not map to any value defined in the schema, the user-specified value is silently ignored and the Status property is not updated on the server.

Example

As it applies to the CommandBarButton, CommandBarComboBox, and CommandBarControl object.

This example moves a control and assigns it a priority of 5 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
		

As it applies to the SharedWorkspaceTask object.

The following example raises the priority of each task in the shared workspace by one step, unless the task priority is already set to High, and uploads the changes to the server. (High priority is the lowest value in the enumeration.)

    Dim swsTask As Office.SharedWorkspaceTask
    Dim lngTaskPriority As MsoSharedWorkspaceTaskPriority
    For Each swsTask In ActiveWorkbook.SharedWorkspace.Tasks
        lngTaskPriority = swsTask.Priority
        If lngTaskPriority > msoSharedWorkspaceTaskPriorityHigh Then
            swsTask.Priority = lngTaskPriority - 1
            swsTask.Save
        End If
    Next
    Set swsTask = Nothing