Resource.GroupBySummary 属性 (Project)

如果资源视图中的选定项位于组摘要行中,则为 True;否则为 False。 只读 Boolean

语法

expressionGroupBySummary

表达 一个代表 Resource 对象的变量。

备注

将一个 分组依据命令应用到资源视图中,组摘要行 资源名称列中显示的组定义。 如果所选单元格位于分组摘要行, 摘要分组 属性为 True

摘要分组 属性是可通过 ActiveCell.Resource属性而不是 ActiveProject.Resources(x)

示例

以下示例将"资源的工作完成情况"分组应用于"资源工作表"视图,然后选择视图中每一行的第一个单元格并测试该行是否是分组摘要。 此过程将继续,直到行为空为止,然后显示一个带有每行测试结果的消息框。

Sub ShowGroupByItems() 
 Dim isValid As Boolean 
 Dim res As Resource 
 Dim rowType As String 
 Dim msg As String 
 
 isValid = True 
 msg = "" 
 
 ActiveProject.Views("Resource Sheet").Apply 
 GroupApply Name:="Complete and Incomplete Resources" 
 Application.SelectBeginning 
 
 ' When a cell in an empty row is selected, accessing the ActiveCell.Resource 
 ' property results in error 1004. 
 On Error Resume Next 
 
 ' Loop until a cell in an empty row is selected. 
 While isValid 
 Set res = ActiveCell.Resource 
 
 If Err.Number > 0 Then 
 isValid = False 
 Debug.Print Err.Number 
 Err.Number = 0 
 Else 
 If res.GroupBySummary Then 
 rowType = "' is a group-by summary row." 
 Else 
 rowType = "' is a resource row." 
 End If 
 
 msg = msg & "Resource name: '" & res.Name & rowType & vbCrLf 
 SelectCellDown 
 End If 
 Wend 
 
 MsgBox msg, vbInformation, "GroupBy Summary for Resources" 
 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。