Share via


Task.ActualDuration Property

Project Developer Reference

Returns or sets the actual duration (in minutes) of a task. Read-only for summary tasks. Read/write Variant.

Syntax

expression.ActualDuration

expression   A variable that represents a Task object.

Example
The following example marks the tasks in the active project that have actual durations that exceed a specified number of minutes.

Visual Basic for Applications
  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.<strong class="bterm">ActualDuration</strong> &gt; Minutes Then T.Marked = True
Next T

End Sub

See Also