B
Bill Bordiuk
I have code that walks through the predecessors of a task using the
TaskDependencies collection to find all paths back to start tasks. This code
works fine unless a task is linked to an external task. Even though the
master and subproject tasks are all displayed, I'm unable to access
predecessors of the 'Ghost' task that project creates to represent the
external link.
Private Sub t1(t As Task, ByVal s As String)
' Recursive walk through a task's predecessors
Dim d As TaskDependency
For Each d In t.TaskDependencies
If t.ID = d.To.ID Then
Debug.Print s & " Pred: " & d.From.ID & "[" & d.From.UniqueID &
"] <" & d.From.Name & "> ext=" & d.From.ExternalTask
t1 d.From, s & " "
End If
Next
End Sub
Public Sub test(p As Project)
Dim t As Task, d As TaskDependency
For Each t In p.Tasks
Debug.Print t.ID & "[" & t.UniqueID & "] : " & t.Name
t1 t, ""
Next
End Sub
Called with Test Activeproject
This code will not walk past an external task. What's strange is that the
Unique IDs of the external tasks are different when you look at them as
predecessors from when you look at them directly. In fact, Project seems to
keep 2 tasks for each external task, the real task and the ghost. If I could
access the real task from the ghost, I could get that task's predecessors
and move through the project. The problem is that I can't find any way to
get to the real task from the ghost except by using the task name to access
the task in the subproject (as in:
Projects(d.from.project).tasks(d.from.name)). This is a problem because
there's no way to be sure that tasks have unique names.
Does anyone have a suggestion/solution here?
Thanks,
Bill B
TaskDependencies collection to find all paths back to start tasks. This code
works fine unless a task is linked to an external task. Even though the
master and subproject tasks are all displayed, I'm unable to access
predecessors of the 'Ghost' task that project creates to represent the
external link.
Private Sub t1(t As Task, ByVal s As String)
' Recursive walk through a task's predecessors
Dim d As TaskDependency
For Each d In t.TaskDependencies
If t.ID = d.To.ID Then
Debug.Print s & " Pred: " & d.From.ID & "[" & d.From.UniqueID &
"] <" & d.From.Name & "> ext=" & d.From.ExternalTask
t1 d.From, s & " "
End If
Next
End Sub
Public Sub test(p As Project)
Dim t As Task, d As TaskDependency
For Each t In p.Tasks
Debug.Print t.ID & "[" & t.UniqueID & "] : " & t.Name
t1 t, ""
Next
End Sub
Called with Test Activeproject
This code will not walk past an external task. What's strange is that the
Unique IDs of the external tasks are different when you look at them as
predecessors from when you look at them directly. In fact, Project seems to
keep 2 tasks for each external task, the real task and the ghost. If I could
access the real task from the ghost, I could get that task's predecessors
and move through the project. The problem is that I can't find any way to
get to the real task from the ghost except by using the task name to access
the task in the subproject (as in:
Projects(d.from.project).tasks(d.from.name)). This is a problem because
there's no way to be sure that tasks have unique names.
Does anyone have a suggestion/solution here?
Thanks,
Bill B