Skip to content

Latest commit

 

History

History
74 lines (49 loc) · 2.8 KB

Project.Application.LinkTasksEdit.md

File metadata and controls

74 lines (49 loc) · 2.8 KB
title keywords f1_keywords ms.service api_name ms.assetid ms.date ms.localizationpriority
Application.LinkTasksEdit method (Project)
vbapj.chm2052
vbapj.chm2052
project-server
Project.Application.LinkTasksEdit
51c1d75e-afb6-ae8c-162d-15e24c81bd06
06/08/2017
medium

Application.LinkTasksEdit method (Project)

Edits task dependencies (task links).

Syntax

expression. LinkTasksEdit( _From_, _To_, _Delete_, _Type_, _Lag_, _PredecessorProjectName_, _SuccessorProjectName_ )

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
From Required Long Long. The identification number of a predecessor task.
To Required Long Long. The identification number of a successor task.
Delete Optional Boolean True if Project deletes the referenced link. The default value is False.
Type Optional Long The relationship between tasks that become linked. Can be one of the PjTaskLinkType constants. The default value is pjFinishToStart.
Lag Optional Variant The duration between linked tasks in default units. To specify lead time between tasks, use a negative value.
PredecessorProjectName Optional String The name of the subproject in a consolidated project that contains the task identified with From. If PredecessorProjectName is omitted, the current project is assumed.
SuccessorProjectName Optional String The name of the subproject in a consolidated project that contains the task identified with To. If SuccessorProjectName is omitted, the current project is assumed.

Return value

Boolean

Example

The following example prompts the user for a range of task identification numbers, and then links the tasks in the range from finish to start. This example assumes the ID range is valid, as well as the absence of any duplicate tasks, null tasks, consolidated projects, and so on.

Sub LinkFinishToStart() 
 
    Dim FirstID As String ' The ID number of the first task 
    Dim LastID As String ' The ID number of the last task 
    Dim NextID As Long ' The ID number of the next task to link 
 
    FirstID = InputBox$("Enter the ID number of the first task to link:") 
    If FirstID = Empty Then Exit Sub 

    LastID = InputBox$("Enter the ID number of the last task to link:") 
    If LastID = Empty Then Exit Sub 
 
    ' Convert FirstID from String to Long, then "seed" the loop. 
    NextID = CLng(FirstID) 
 
    Do Until NextID = CLng(LastID) 
        LinkTasksEdit From:=NextID, To:=NextID + 1, Type:=pjFinishToStart 
        NextID = NextID + 1 
    Loop 
End Sub

[!includeSupport and feedback]