Got a problem with VBA using MS Project 2007. I have a Task Task
with 2 Assignments, including the Resources Foo
(2 days of work) and Bar
(5 days of work). Task
is set to fixed work. Now, when adding additional or removing Assignments manually to/from the Task, all works as expected, nothing fancy happening. When using VBA, like the following, the other Assignments' work values change.
' Adding an Assignment with the "Baz" Resource and 10d of work
Sub AddAssignment()
Dim tskTask As Task
Dim rsResource As Resource
Dim asAssignment As Assignment
Set tskTask = ActiveProject.Tasks(1)
Set rsResource = ActiveProject.Resources("Baz")
Set asAssignment = tskTask.Assignments.Add(tskTask.ID, rsResource.ID)
asAssignment.Work = "10d"
End Sub
Before executing the script:
Task:
Foo 16h
Bar 40h
After executing the script:
Task:
Foo 9,33h
Bar 23,33h
Baz 80h
So, actual question, what do I have to do different in order to keep the other Assignments' work values?