# SortKey Element

When the SortKey element is contained in a Act element, it specifies a number that determines the order of actions that appear on a shortcut or smart tag menu.

When the SortKey element is contained in a Hyperlink element, it specifies a number that determines the order of hyperlinks that appear on a shortcut menu.

When the SortKey element is contained in a Prop element, it specifies a key that determines the order in which custom properties are listed in the application's user interface.

## Syntax

    <SortKey>
        [Unit]
        [F]
        [Err]
        [V]>
    </SortKey>

## Attributes

Unit

Optional string. Represents a unit of measure. The default is STR. For details about STR, see Units of measure.

F

Optional string. Represents the element's formula. This attribute can contain one of the following strings: "someFormula" if the formula exists locally, "No Formula" if the formula is locally deleted or blocked, or "Inh" if the formula is inherited.

If the attribute is not present, the element's formula is a simple constant. For example, <element>5</element>.

Err

Optional string. Indicates that the formula evaluates to an error. The value of Err is the current value (an error message string); the value of the element is the last valid value.

V

Optional string. Represents the null string condition for a string cell value. In some cases it is helpful to distinguish between an empty string cell null and a null string cell value. This attribute is used to distinguish between these forms of an empty value.

## Element properties

Property | Value
--- | ---
Name | SortKey
Minimum Occurrences | 0
Maximum Occurrences | 1

## Element information

Parent elements

Act

Prop

Hyperlink

Child elements

None

## Remarks

The actions on a smart tag or shortcut menu appear on the menu sorted from lowest to highest, with lower numbers appearing at the top of the menu. If two action elements have the same SortKey element value, the order is determined by physical row order. The default is 0 (zero).

The hyperlinks on a shortcut menu appear on the menu sorted from lowest to highest, with lower numbers appearing at the top of the menu. If two hyperlink elements have the same SortKey element value, the order is determined by physical row order. The default is 0 (zero).

The comparison of sort keys for custom properties is locale-specific, case insensitive, and descending.

For example, the following sort keys can be used to display the custom properties elements in the user interface in the following order: Item Number, Quantity, Price

Prop element name | Label | Sort key
--- | --- | ---
Prop.Item | Item Number | 1
Prop.Price | Price | 3
Prop.Quan | Quantity | 2

The SortKey element is relevant only when contained in a DocumentSheet, PageSheet, or Shape element. It is ignored when contained in a StyleSheet element.

## See also

SortKey cell (Actions section)

SortKey cell (Custom Properties section)

SortKey cell (Hyperlinks section)

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp