Looking at automating some basic project data and running some trials but running into this problem of adding existing tasks to the timeline. Here's my code inside a Project file module:
Public Sub TestIt()With Application.ActiveProject
With .Tasks.Add("First Task")
.Start = "30/09/2014 9:00 AM"
.Duration = "5 days"
End With
With .Tasks.Add("Second Task")
.Duration = "6 days"
End With
With .Tasks.Add("Third Task")
.Duration = "7 days"
End With
Dim t As Task
For Each t In .Tasks
If t.ID <> 1 Then t.Predecessors = t.ID - 1
TaskOnTimeline t.ID'<-Fails here
Next
End With
End Sub
Any ideas what I'm doing wrong here?
Brad