共用方式為


Task.ActualDuration 屬性 (Project)

取得或設定一個任務的實際工期 (以分鐘為單位)。 唯讀的摘要任務。 讀取/寫入 Variant

語法

expressionActualDuration

表達 代表 Task 物件的變數。

範例

下面範例會在使用中專案內,標記實際工期大於指定之分鐘數的任務。

Sub MarkLongDurationTasks() 
 
 Dim T As Task ' Task object used in For Each loop 
 Dim Minutes As Long ' Duration entered by user 
 
 ' Prompt user for the actual duration, in minutes. 
 Minutes = Val(InputBox$("Enter the actual duration, in minutes: ")) 
 
 ' Don't do anything if the InputBox$ was cancelled. 
 If Minutes = 0 Then Exit Sub 
 
 ' Cycle through the tasks of the active project. 
 For Each T In ActiveProject.Tasks 
 ' Mark a task if it exceeds the duration. 
 If T.ActualDuration > Minutes Then T.Marked = True 
 Next T 
 
End Sub

支援和意見反應

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