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 支持和反馈,获取有关如何接收支持和提供反馈的指南。