Share via


Task.UnlinkSuccessors Method

Project Developer Reference

Removes successors from a task.

Syntax

expression.UnlinkSuccessors(Tasks)

expression   A variable that represents a Task object.

Parameters

Name Required/Optional Data Type Description
Tasks Required Object The successor Task or Tasks specified with Tasks are removed from the task specified with expression.

Return Value
Nothing

Example
The following example removes the specified successor from every task in the active project.

Visual Basic for Applications
  Sub RemoveSuccessor()
Dim Entry As String     ' Successor specified by user
Dim SuccTask As Task    ' Successor task object
Dim T As Task           ' Task object used in For Each loop
Dim S As Task           ' Successor (task object) used in loop

Entry = InputBox$("Enter the name of a successor to unlink from every task in this project.")
Set SuccTask = Nothing

' Look for the name of the successor in tasks of the active project.
For Each T In ActiveProject.Tasks
    If T.Name = Entry Then
        Set SuccTask = T
        Exit For
    End If
Next T

' Remove the successor from every task in the active project.
If Not (SuccTask Is Nothing) Then
    For Each T In ActiveProject.Tasks
        For Each S In T.SuccessorTasks
            If S.Name = Entry Then
                T.<strong class="bterm">UnlinkSuccessors</strong> SuccTask
                Exit For
            End If
        Next S
    Next T
End If

End Sub

See Also