共用方式為


Project) (Task.PercentComplete 屬性

取得或設定任務的完成百分比。 讀取/寫入 Variant

語法

expressionPercentComplete

表達 代表 Task 物件的變數。

範例

下列範例會移除包含兩項以上資源且完成百分比為 85 之任務中的其中一項資源。

Sub ReallocateResource() 
 
 Dim Entry As String ' The name of the resource to remove 
 Dim T As Task ' The task object used in For loop 
 Dim RA As Assignment ' The resource assignment object to the task 
 
 Entry = InputBox$("Enter a resource name:") 
 
 ' Remove the resource from 85 percent complete tasks with 2+ resources. 
 For Each T In ActiveProject.Tasks 
 If T.PercentComplete >= 85 And T.Resources.Count >= 2 Then 
 For Each RA In T.Assignments 
 If UCase(Entry) = UCase(RA.ResourceName) Then 
 RA.Delete 
 End If 
 Next 
 End If 
 Next T 
 
End Sub

支援和意見反應

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