Project) (Resource.GroupBySummary 屬性
如果 資源檢視中選取的專案位於群組摘要資料列中,則為 True;否則為 False。 唯讀的 Boolean。
語法
expression。 GroupBySummary
表達 代表 Resource 物件的變數。
註解
當您在資源檢視來套用 群組依據] 命令時,群組摘要列會顯示 [ 資源名稱] 欄中的群組定義。 如果選取的儲存格群組摘要列中, GroupBySummary 屬性為 True 。
GroupBySummary 屬性是可透過 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 支援與意見反應。