TaskGroups Object (Project)
Represents all the task-based group definitions. TaskGroups is a collection of Group objects.
For task groups where the group hierarchy can be maintained and cell color can be a hexadecimal value, use the TaskGroups2 collection object.
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 tGroups As String For Each tg in ActiveProject.TaskGroups tGroups = tGroups & tg.Name & vbCrLf Next tg MsgBox tGroups
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.