material resource assigned at 5/day

R

Robert

Hello,
I need to assign (via VBA) a material resource to the selected task. For ex.
5 units/day
In the following setting, how can I say that I want to assign the MatRess at
5/d ?
ActiveSelection.Tasks(1).Assignments.Add ResourceID:=MatRes, Units:=????

Thanks for your help
 
J

Jan De Messemaeker

Hallo Robert,

Sorry, I fail to see how you could use assignments.add to do this directly
But once the assignment is created (with any units value) the following
works:
activeproject.Tasks(1).Assignments(1).Units="5/d"

When, as in your example, the task is selected, you can use the
resourceassignment method which also accepts 5/D as units.

Hope this helps
 
R

Robert

Thanks Jan,

Eventually, the following setting worked for me :
ResourceAssignment Resources:="MatRes[" & nb & "/j]"
where nb is a variable.

Rob
 
J

Jan De Messemaeker

Hi,

Glad you made it work!

--
Jan De Messemaeker
Microsoft Project MVP
http://users.online.be/prom-ade
Robert said:
Thanks Jan,

Eventually, the following setting worked for me :
ResourceAssignment Resources:="MatRes[" & nb & "/j]"
where nb is a variable.

Rob

Jan De Messemaeker said:
Hallo Robert,

Sorry, I fail to see how you could use assignments.add to do this
directly
But once the assignment is created (with any units value) the following
works:
activeproject.Tasks(1).Assignments(1).Units="5/d"

When, as in your example, the task is selected, you can use the
resourceassignment method which also accepts 5/D as units.

Hope this helps
 

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