VBA ActualWork by Resource ?

C

Chris

This seems simple but for some reason I can't figure it out...

Trying to get the ActualWork by a resource for a given task but (using the
code below) I get erroneous data:

--------
Dim T As Task
Dim Ts As Tasks
Dim R As Resource
Dim Rs As Resources

For Each T In Ts
TotalHours = T.ActualWork / 60

.... some other code ...

For Each R In T.Resources
TotalResHours = Ts(T.ID).Resources(R.ID).ActualWork / 60


.... some other code ... dumps it in an array, etc...
------------

Basically, for what I'm trying to do, is:
TotalResHours = Ts(T.ID).Resources(R.ID).ActualWork / 60

the correct way to get the total hours a person worked on the task?

Thanks for any help
 
J

Jan De Messemaeker

Hi,

No.
Sometask.resources(i) yields the subject resource object, not the ASSIGNMENT
object which is what you are looking for.

For each Ass in sometask.assignments
if Ass.resourcename="The man's name"" then
debug.print ass.actualwork/60
end if
next ass

will do the trick.

You can read some background in Faq 51 in
http://www.mvps.org/project/faqs.htm

Greetings,
 

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