John, I really must have been so not clear about my goal. This is actually a
follow up on a post I made some time ago. I replied there, but for some
reason the post did not come to the top of list, by date, therefore I though
nobody will really see I was following up, so I created this new post.
I tried to achieve copying a task with the code below. It works well for
assignments that are not splitted.
Your explanation was informative, but I did not manage to understand how the
split information is stored, and how am I supposed to recreate it if I want
to "copy" that splitted task.
Since all I've got is the resource, I don't know how to get to the original
task. You said the assignments are the bridge between the resource and the
task; so how do I address the task, having the resource, and the "bridge"?
Private Sub CreateResGroup(r As Resource)
Dim header as Long
Dim asg As Assignment
'Add a summary task with the name of the resource
header = ActiveProject.Tasks.Add(r.Name)
ActiveProject.Tasks(header).SetField pjTaskOutlineLevel, "1"
'Copy the resource assignments, make it "subtask"
For Each asg In r.Assignments
newasg = ActiveProject.Tasks.Add(asg.TaskName)
With ActiveProject.Tasks(newasg)
.Start = asg.Start
.Finish = asg.Finish
.Work = asg.Work
.Estimated = "No"
.Milestone = "No"
.SetField pjTaskOutlineLevel, "2"
.SetField pjTaskRollup, "Yes"
End With
Next asg
End Sub
In case you want to look at the full history, this would be the link to the
original post "Task Serial View" on this
forum:
http://www.microsoft.com/office/community/en-us/default.mspx?query=Seria
l&dg=microsoft.public.project.developer&cat=en-us-microsoftproject&lang=en&cr=
US&pt=a1d023a3-f612-4da2-acb8-fda8f850d645&catlist=&dglist=&ptlist=&exp=&sloc=
en-us