TaskGroups object (Project)

Represents all the task-based group definitions. TaskGroups is a collection of Group objects.

Remarks

For task groups where the group hierarchy can be maintained and cell color can be a hexadecimal value, use the TaskGroups2 collection object.

Example

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.

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

Methods

Name
Add
Copy

Properties

Name
Application
Count
Item
Parent

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.