Hi,

I am trying to build a master Gantt for visual purposes using predecessors to identify what subproject task, summary task or milestone the master task should emulate. This works fine except for when I try to retrieve baseline dates for milestones. If the predecessor task is a zero duration task then the item in the PredecessorTasks collection has blank or "NA" baseline dates, despite the actual zero duration task having baseline dates. If the predecessor task has a duration > 0 then it works.

I Would appreciate any insights as to why this might be, how I can fix it.

My code is below:

Sub RollupSummary()

Dim currentTask As Task
Dim linkTask As Task
Dim result As Boolean

For Each currentTask In ActiveProject.Tasks
If currentTask.Text13 = "y" And currentTask.ExternalTask = False And currentTask.Summary = False And currentTask.PredecessorTasks.Count > 0 Then
Set linkTask = currentTask.PredecessorTasks.Item(1)
If currentTask.PredecessorTasks.Count > 1 Then
result = MsgBox("Task " & currentTask.Name & " links more than one parent task", vbOKOnly, "Multiple Predecessors")
Else
currentTask.Calendar = "None"
currentTask.Duration = 0
currentTask.PercentComplete = 0
currentTask.Calendar = linkTask.Calendar
currentTask.BaselineStart = linkTask.BaselineStart
currentTask.BaselineFinish = linkTask.BaselineFinish

currentTask.Start = linkTask.Start
currentTask.Duration = linkTask.Duration
currentTask.PercentComplete = linkTask.PercentComplete
End If
Set linkTask = Nothing
End If
Next

End Sub