Sort Method

Sorts the tasks or resources in the active pane.

Syntax

expression**.Sort(Key1, Ascending1, Key2, Ascending2, Key3, Ascending3, Renumber, Outline)**

*expression   *     Optional. An expression that returns an Application object.

Key1    Optional String. The name of a primary field to sort. If Key1 is omitted, the Sort dialog box appears, which prompts the user to specify sorting information.

Ascending1    Optional Boolean. True if the primary field will be sorted in ascending order. The default value is True.

Key2    Optional String. The name of a secondary field to sort.

Ascending2    Optional Boolean. True if the secondary field will be sorted in ascending order. The default value is True.

Key3    Optional String. The name of a tertiary field to sort.

Ascending3    Optional Boolean. True if the tertiary field will be sorted in ascending order. The default value is True.

Renumber    Optional Boolean. True if Microsoft Office Project 2003 should renumber tasks after sorting them. For task views, Renumber can be True only if Outline is True. If Outline is True, then Renumber defaults to the current setting in the Sort dialog box. If Outline is False, Renumber is ignored.

Outline    Optional Boolean. True if the outline level of tasks or resources will be preserved after sorting them. The default value is True.

Example

The following example sorts the tasks in the active project by priority, and then renumbers the tasks.

Sub SortByPriority()
    Sort Key1:="Priority", Ascending1:=True, Renumber:=True
End Sub

Applies to | Application Object

See Also | CheckField Method