TaskGroups Collection Object

Project Developer Reference

Represents all the task-based group definitions.

Using the TaskGroups Collection

Use the TaskGroups property to return a TaskGroups collection. The following example lists the names of all the task groups in the active project.

  Dim TG As Group
Dim Groups As String

For Each TG in ActiveProject.TaskGroups Groups = Groups & TG.Name & vbCrLf Next TG

MsgBox Groups

Use the Add method to add a Group object to the TaskGroups collection. The following example creates a new group that groups tasks by whether they are overallocated and then modifies the criterion so that overallocated tasks are sorted in descending order.

  ActiveProject.TaskGroups.Add "Overallocated Tasks", "Overallocated"
ActiveProject.TaskGroups("Overallocated Tasks").GroupCriteria(1).Ascending = False

See Also