K
Kris Rudin
I am trying to export tasks from an existing project to one I'm creating.
Here's what I'm doing:
For Each t In Application.ActiveProject.Tasks
If Not t Is Nothing Then 'prevent reference of null task
Set newTask = newProj.Tasks.Add(t.Name, t.ID) 'using ID of
original task preserves ID numbering in new project (blank lines)
newTask.Start = t.Start
newTask.Name = t.Name
newTask.Duration = t.Duration
newTask.OutlineLevel = t.OutlineLevel
'newTask.Predecessors = t.Predecessors
End If
Next
All is proceeding fairly well, except for a couple of items:
1. For all tasks in the new project, the duration is always displayed with a
question mark ("0 days?", "10 days?"), despite the fact that in the original
plan they are not shown that way, and I'm explicitly copying them, as seen
in my code.
2. For two tasks in the new project (one is a milestone, one is not), the
predecessors value is incorrect. There is an ID there, but it is not the
correct one. All other predecessors are correct.
3. For the erroneous milestone task (in #2), the start date is incorrect,
despite the fact that I explicitly copy it, as seen in my code. All other
start dates are correct.
Can anyone figure out why these things would be happening?
Thanks,
Kris
Here's what I'm doing:
For Each t In Application.ActiveProject.Tasks
If Not t Is Nothing Then 'prevent reference of null task
Set newTask = newProj.Tasks.Add(t.Name, t.ID) 'using ID of
original task preserves ID numbering in new project (blank lines)
newTask.Start = t.Start
newTask.Name = t.Name
newTask.Duration = t.Duration
newTask.OutlineLevel = t.OutlineLevel
'newTask.Predecessors = t.Predecessors
End If
Next
All is proceeding fairly well, except for a couple of items:
1. For all tasks in the new project, the duration is always displayed with a
question mark ("0 days?", "10 days?"), despite the fact that in the original
plan they are not shown that way, and I'm explicitly copying them, as seen
in my code.
2. For two tasks in the new project (one is a milestone, one is not), the
predecessors value is incorrect. There is an ID there, but it is not the
correct one. All other predecessors are correct.
3. For the erroneous milestone task (in #2), the start date is incorrect,
despite the fact that I explicitly copy it, as seen in my code. All other
start dates are correct.
Can anyone figure out why these things would be happening?
Thanks,
Kris