Application.LinkTasks method (Project)

Links the selected tasks in the Gantt Chart, Calendar, Task Sheet, or Task Usage view.

Syntax

expression. LinkTasks

expression A variable that represents an Application object.

Return value

Boolean

Example

The following example a couple of tasks and links them.

Sub Link_Tasks() 
 
 'Activate Task Sheet view 
 ViewApply Name:="Task Sheet" 
 
 ' Create a coupe of tasks 
 RowInsert 
 SetTaskField Field:="Name", Value:="TestTask-2" 
 SetTaskField Field:="Duration", Value:="5" 
 
 RowInsert 
 SetTaskField Field:="Name", Value:="TestTask-1" 
 SetTaskField Field:="Duration", Value:="10" 
 
 'Select tasks 
 SelectRow 
 SelectRow Row:=1, Add:=True 
 
 'Link the two tasks 
 LinkTasks 
 
 'delete the tasks 
 ActiveProject.Tasks("TestTask-1").Delete 
 ActiveProject.Tasks("TestTask-2").Delete 
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.