TaskDependencies object (Project)

Contains a collection of TaskDependency objects.

Example

Using the TaskDependency Object

Use TaskDependencies (index), where index is the dependency index, to return a single TaskDependency object. The following example adds 1.5 days of lag to the link between the specified task and the predecessor specified in its first task dependency.

ActiveProject.Tasks("Draft Initial Business Case").TaskDependencies(1).Lag = "1.5d"

Using the TaskDependencies Collection

Use the TaskDependencies property to return a TaskDependencies collection. The following example examines each predecessor for the specified task and displays a message for each that has a priority of "High" or better.

Dim TaskDep As TaskDependency 

 

For Each TaskDep In ActiveProject.Tasks("Write Requirements Brief").TaskDependencies 

 If TaskDep.From.Priority > 500 Then 

 MsgBox "Task #" & TaskDep.From.ID & " (" & TaskDep.From.Name & ") " & _ 

 "has a priority higher than medium." 

 End If 

Next TaskDep

Use the Add method to add a TaskDependency object to the TaskDependencies collection. The following example links "Preliminary Research & Approval" as a predecessor to "Draft Initial Business Case" in a finish-to-start relationship.

ActiveProject.Tasks("Draft Initial Business Case").TaskDependencies.Add ActiveProject.Tasks("Preliminary Research & Approval"), pjFinishToStart

Methods

Name
Add

Properties

Name
Application
Count
Item
Parent

See also

Project Object Model

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.