Share via


Application.LinkTasks Method

Project Developer Reference

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.

Visual Basic for Applications
  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

See Also