Task.ActualDuration property (Project)

Gets 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.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.