Share via


Application.Sort Method

Project Developer Reference

Sorts the tasks or resources in the active pane.

Syntax

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

expression   A variable that represents an Application object.

Parameters

Name Required/Optional Data Type Description
Key1 Optional Variant 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 2007 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.

Return Value
Boolean

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

Visual Basic for Applications
  Sub SortByPriority()
    Sort Key1:="Priority", Ascending1:=True, Renumber:=True
End Sub

See Also