TaskGroups2 object (Project)

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

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

Methods

Name
Add
Copy

Properties

Name
Application
Count
Item
Parent

See also

Project Object Model

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.