Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

TaskOnTimeLine failing - Argument value is not valid

$
0
0

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


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>