GroupCriterion2 object (Project)

Represents a criterion in a group definition where the group hierarchy can be maintained and cell color can be a hexadecimal value. The GroupCriterion2 object is a member of the GroupCriteria2 collection.

Example

Using the GroupCriterion2 Object

Use **GroupCriteria2(**Index ), whereIndex is the criterion index, to return a single GroupCriterion2 object. The following example sets the cell color for the first criterion in the Standard Rate resource group to blue.

ActiveProject.ResourceGroups2("Standard Rate").GroupCriteria2(1).CellColor = &HFF0000

Using the GroupCriteria2 Collection

Use the GroupCriteria property to return a GroupCriteria2 collection. The following example displays a list of the fields used as criteria in the specified task group and shows whether they are sorted in ascending or descending order.

Dim GC2 As GroupCriterion2  
Dim Fields As String  
  
For Each GC2 In ActiveProject.TaskGroups2("Priority Keeping Outline Structure").GroupCriteria  
    If GC2.Ascending = True Then  
        Fields = Fields & GC2.Index & ". " & GC2.FieldName & " is sorted in ascending order." & vbCrLf  
    Else  
        Fields = Fields & GC2.Index & ". " & GC2.FieldName & " is sorted in descending order." & vbCrLf  
    End If  
Next GC2  
  
MsgBox Fields

Use the AddEx method to add a GroupCriterion2 object to the GroupCriteria2 collection, where CellColor can be a hexadecimal value. The following example adds another criterion to the specified resource group, grouping resources in ascending order as determined by the percentage of their work (in 25-percent increments) that is complete.

ActiveProject.ResourceGroups2("Response Pending").GroupCriteria2.AddEx "% Work Complete", True, _
    CellColor:=&H0101FF, GroupOn:=pjGroupOnPct1_25

Methods

Name
Delete

Properties

Name
Application
Ascending
Assignment
CellColor
CellColorEx
FieldName
FontBold
FontColor
FontColorEx
FontItalic
FontName
FontSize
FontUnderLine
GroupInterval
GroupOn
Index
Parent
Pattern
StartAt

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.