共用方式為


Task.Summary 屬性 (Project)

True 是表示 如果任務是摘要任務。 唯讀的 Boolean

語法

運算式總結

表達 代表 Task 物件的變數。

範例

下列範例會檢查作用中任務中的摘要任務是否有工作分派。

注意事項

[!注意事項] 摘要任務不應該有工作分派。

Sub CheckAssignmentsOnSummaryTasks() 
 Dim tsk As Task 
 Dim message As String 
 Dim numAssignments As Integer 
 Dim numSummaryTasksWithAssignments As Integer 
 Dim msgStyle As VbMsgBoxStyle 
 
 message = "" 
 numSummaryTasksWithAssignments = 0 
 
 For Each tsk In ActiveProject.Tasks 
 If tsk.Summary Then 
 numAssignments = tsk.Assignments.Count 
 If numAssignments > 0 Then 
 message = message & "Summary task ID (" & tsk.ID & "): " & tsk.Name _ 
 & ": " & numAssignments & " assignments" & vbCrLf 
 numSummaryTasksWithAssignments = numSummaryTasksWithAssignments + 1 
 End If 
 End If 
 Next tsk 
 
 If numSummaryTasksWithAssignments > 0 Then 
 message = "There are " & numSummaryTasksWithAssignments _ 
 & " summary tasks that have assignments." & vbCrLf & vbCrLf & message 
 msgStyle = vbExclamation 
 Else 
 message = "No summary tasks have assignments." 
 msgStyle = vbInformation 
 End If 
 
 MsgBox message, msgStyle, "Summary Task Check" 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應