setting work of a task with excel - problem with assigning twoassignments to a task

S

santeria

hi there,

i m trying to export from an excel sheet the hours of work of tasks to
a new ms project project. therefore first i create a new project and
add all my tasks. then i add all my resources and then i execute the
code below. for each resources i check whether in the excel file
working hours are assigned to a task and if yes i add this working
hours to the corresponding task in ms project.

this works perfectly fine for assigning one assignment to a task. if i
add two or more assignments to a task ms project recalculates the work
of the previously added working hours. often it seems for me that ms
project just set the previously working hours to 50% for each
additionally added assignment.

can anybody tell me how i can prevent this behaviour? i tried allready
to set the type of the task to pjFixedWork but it did not helped :(

would appreciate any help!
tom

'export resource working hours
For Each r In ActiveProject.Resources
If Not (r Is Nothing) Then
For Each t In ActiveProject.Tasks
If Not (t Is Nothing) And t.OutlineLevel <> 1 Then
t.Type = pjFixedWork
'1. add an assignment with the actual resource to
the task
'2.
If Application.Worksheets(a).Cells(line, o).Value
<> "" Then
'units can be set in decimal - e.g. 0.25
t.Assignments.Add ResourceID:=getResID
(r.Name), Units:=1

Set assi = t.Assignments(t.Assignments.Count)
'Work property has to be set in minutes
assi.Work = Application.Worksheets(a).Cells
(line, o).Value * 60
End If

End If
line = line + 1
Next t
line = 9
End If
o = o + 1
Next r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top