Application.UpdateTasks 方法 (Project)
會更新選取的任務。
語法
expression。 UpdateTasks
( _PercentComplete_
, _ActualDuration_
, _RemainingDuration_
, _ActualStart_
, _ActualFinish_
, _Notes_
)
expression 代表 Application 物件的變數。
參數
名稱 | 必要/選用 | 資料類型 | 描述 |
---|---|---|---|
PercentComplete | 選用 | Variant | 使用中任務的完成百分比。 |
ActualDuration | 選用 | Variant | 所選取任務的實際工期。 |
RemainingDuration | 選用 | Variant | 所選取任務的剩餘工期。 |
ActualStart | 選用 | Variant | 所選取任務的實際開始日期。 |
ActualFinish | 選用 | Variant | 所選取任務的實際完成日期。 |
Notes | 選用 | String | 所選取任務之 [附註] 欄位中的註解。 值只能是文字,而不是 [附註] 對話方塊中的 RTF 格式。 |
傳回值
布林值
註解
使用 UpdateTasks 方法但未指定任何引數會顯示 [ 更新任務] 對話方塊。
範例
下列範例會建立名為 "TestTask-1" 的任務,並將該任務更新為 50% 完成,然後刪除該任務。
Sub Update_Tasks()
'Activate Gantt Chart
ViewApply Name:="Gantt Chart"
'Create a task
RowInsert
SetTaskField Field:="Name", Value:="TestTask-1"
SetTaskField Field:="Duration", Value:="2"
'Update the percent complete of the new task.
UpdateTasks PercentComplete:="50"
'Delete the new task
ActiveProject.Tasks("TestTask-1").Delete
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。