Project 2003 VBA - Resources by Task

C

CQ

I am not good at VBA and I am trying to get a listing of all the resources
assigned to a task. THEN, I want to take each resource, multiply work hours
by resource by a custom rate field and sum that up for all the resources so
that I have the total cost by task - putting the result into a custom field.
I think I am as far as getting the assignments...

Here is what I have thus far (which is failing miserably):
Dim ts As Tasks
Dim t As Task
Dim res As Resource
Dim agn As Assignment

Set ts = ActiveProject.Tasks

For Each t In ts
If Not t Is Nothing Then
For Each res In ActiveProject.Resources
If Not res Is Nothing Then
For Each agn In ts.Assignments

End If
End If
Next t
 
R

Rod Gill

Are you trying to calculate a margin (all work at rate for customer less all
work at internal rate? If so, (apart from this very example being in my
book!) set Rate A for each Resource as the rate to customer, and Rate B for
each resource to their internal rate.

How set all Cost Rate Table values (insert this column in Task or Resource
usage View to see it) to B, copy Cost in Gantt Chart to Cost1 custom field.

Reset Cost Rate Table to rate A for all assignments

Add formula in Cost2 field: call Cost2 margin and make formula
[Cost1]-[Cost]

Done!

Record yourself doing this all manually to get the bare bones, then optimise
manually.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 

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