Table of contents
TOC
Collapse the table of content
Expand the table of content

Task.LinkSuccessors Method (Project)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Adds one or more successors to the task.

Syntax

expression. LinkSuccessors( ** Tasks, ** Link, ** Lag** )

expression A variable that represents a Task object.

Parameters

NameRequired/OptionalData TypeDescription
TasksRequiredObjectThe Task or Tasks object specified becomes a successor of the task specified with expression.
LinkOptionalLongA constant that specifies the relationship between tasks that become linked. Can be one of thePjTaskLinkType constants. The default value is pjFinishToStart.
LagOptionalVariantA 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.

Return Value

Nothing

Example

The following example create two tasks and links the second task as successor to the first.

Sub Link_Successors() 
    Dim SucessorTask 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 SucessorTask = ActiveProject.Tasks("TestTask-2") 

    PredecessorTask.LinkSuccessors Tasks:=SucessorTask, Link:=pjFinishToStart 

    'delete the tasks 
    PredecessorTask.Delete 
    SucessorTask.Delete 
End Sub
© 2018 Microsoft