TaskGroups2 Collection Object (Project)

Represents all the task-based group definitions, where group hierarchy can be maintained. TaskGroups2 is a collection of Group2 objects.

Version Information

Version Added: Project 2010

Example

Using the TaskGroups2 Collection

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

Dim tg2 As Group2 

Dim tGroups2 As String 

 

For Each tg2 in ActiveProject.TaskGroups2 

 tGroups2 = tGroups2 & tg2.Name & vbCrLf 

Next tg2 

 

MsgBox tGroups2

Use the Add method to add a Group2 object to the TaskGroups2 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.TaskGroups2.Add "Overallocated Tasks", "Overallocated" 

ActiveProject.TaskGroups2("Overallocated Tasks").GroupCriteria(1).Ascending = False

See Also

Concepts

Project Object Model

TaskGroups2 Object Members