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

Task.UnlinkSuccessors Method (Project)

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

Removes one or more successors from the task.

Syntax

expression. UnlinkSuccessors( ** Tasks** )

expression A variable that represents a Task object.

Parameters

NameRequired/OptionalData TypeDescription
TasksRequiredObjectCan be a Task or Tasks object, which specifies one or more tasks that are removed as successors.

Return Value

Nothing

Example

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

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.UnlinkSuccessors SuccTask 
                    Exit For 
                End If 
            Next S 
        Next T 
    End If 
End Sub
© 2018 Microsoft