ResourceGroups2 Collection Object (Project)

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

Version Added: Project 2010

Using the ResourceGroups2 Collection

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

Dim rg2 As Group2 

Dim rGroups2 As String 

 

For Each rg2 in ActiveProject.ResourceGroups2 

 rGroups2 = rGroups2 & rg2.Name & vbCrLf 

Next rg2 

 

MsgBox rGroups2

Use the Add method to add a Group2 object to the ResourceGroups2 collection. The following example creates a new group that groups resources by their standard rate and then modifies the criterion so that the resources are sorted in descending order.

ActiveProject.ResourceGroups2.Add "Resources by Rate", "Standard Rate" 

ActiveProject.ResourceGroups2("Resources by Rate").GroupCriteria(1).Ascending = False
Show: