how to use LinkedFieldID to display linked field for hammock tasks?

From: Denis (
Date: 05/19/04

Date: Wed, 19 May 2004 23:01:00 +0200

I try to display the name of the task to which the successor task is linked
to to create a hammock task.
Mike Morey wrote the following code to display the "true" predecessor's
Imagine B is a hammock task between A and C. How could this code be modified
to display the name of the "linked predecessor" task A to wich the successor
hammock task B is linked (start of B is linked to end of A) and display the
name of the final task C to which the end of task B is linked too.

Here is Mike's code (which serves its purpose perfectly btw, thx Mike)

Sub PredName()
Dim t As Task
Dim tdep As TaskDependency
Dim mytext As String
Dim Linkedpred As String

For Each t In ActiveProject.Tasks
    If Not t Is Nothing Then
        If t.Predecessors <> "" Then
        t.Text15 = ""
        For Each tdep In t.TaskDependencies
            If Not tdep Is Nothing Then
            mytext = "(" & tdep.From.ID & ") " & tdep.From.Name & " "
                 If t.ID <> tdep.From.ID Then
                    If Len(t.Text15) < 256 Then
                    If Len(t.Text15) + Len(mytext) <= 256 Then
                        t.Text15 = t.Text15 & mytext
                        t.Text15 = t.Text15 & Left(mytext, 255 -
                    End If
                    End If
                End If
            End If
        Next tdep
        End If
    End If
Next t
End Sub