title | ms.service | api_name | ms.assetid | ms.date | ms.localizationpriority | |
---|---|---|---|---|---|---|
Task.LinkSuccessors method (Project) |
project-server |
|
397fff8c-3ff3-4725-2938-fdaecddf624b |
06/08/2017 |
medium |
Adds one or more successors to the task.
expression. LinkSuccessors
( _Tasks_
, _Link_
, _Lag_
)
expression A variable that represents a Task object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Tasks | Required | Object | The Task or Tasks object specified becomes a successor of the task specified with expression. |
Link | Optional | Long | A constant that specifies the relationship between tasks that become linked. Can be one of the PjTaskLinkType constants. The default value is pjFinishToStart. |
Lag | Optional | Variant | A string that specifies the duration of lag time between linked tasks. To specify lead time between tasks, use an expression for Lag that evaluates to a negative value. |
Nothing
The following example create two tasks and links the second task as successor to the first.
Sub Link_Successors()
Dim SuccessorTask As Task
Dim PredecessorTask As Task
'Activate Task Sheet view
ViewApply Name:="Task Sheet"
' Create a coupe of tasks
RowInsert
SetTaskField Field:="Name", Value:="TestTask-2"
SetTaskField Field:="Duration", Value:="1"
RowInsert
SetTaskField Field:="Name", Value:="TestTask-1"
SetTaskField Field:="Duration", Value:="2"
'link them
Set PredecessorTask = ActiveProject.Tasks("TestTask-1")
Set SuccessorTask = ActiveProject.Tasks("TestTask-2")
PredecessorTask.LinkSuccessors Tasks:=SuccessorTask, Link:=pjFinishToStart
'delete the tasks
PredecessorTask.Delete
SuccessorTask.Delete
End Sub
[!includeSupport and feedback]