GroupCriterion2 对象 (Project)
代表分组定义位置可以维护组层次结构和单元格的颜色可以是十六进制值条件。 GroupCriterion2 对象是 GroupCriteria2 集合的一个成员。
示例
使用 GroupCriterion2 对象
使用 **GroupCriteria2 (**Index) (其中Index 是条件索引)可返回单个 GroupCriterion2 对象。 下面的示例设置第一个条件单元格的颜色为蓝色的标准费率资源组中。
ActiveProject.ResourceGroups2("Standard Rate").GroupCriteria2(1).CellColor = &HFF0000
使用 GroupCriteria2 集合
使用 GroupCriteria 属性返回 GroupCriteria2 集合。 下面的示例显示在指定的任务组中作为条件的一系列域,并说明这些域是按照升序还是降序排序。
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
使用 AddEx 方法将 GroupCriterion2 对象添加到 GroupCriteria2 集合中,其中 CellColor 可以是十六进制值。 下面的示例向指定的资源组中添加另一个条件,并按照完成工作量的百分比(以 25% 为增量)以升序对资源分组。
ActiveProject.ResourceGroups2("Response Pending").GroupCriteria2.AddEx "% Work Complete", True, _
CellColor:=&H0101FF, GroupOn:=pjGroupOnPct1_25
方法
名称 |
---|
Delete |
属性
名称 |
---|
Application |
升序 |
Assignment |
CellColor |
CellColorEx |
FieldName |
FontBold |
FontColor |
FontColorEx |
FontItalic |
FontName |
FontSize |
FontUnderLine |
GroupInterval |
GroupOn |
索引 |
Parent |
Pattern |
StartAt |
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:提交和查看相关反馈