Resource names column show hours per task not percentage?

N

nattyboy

Hi, I'm new to this, but back in 2005 a question was posed about "How can I
have the resource names column show hours per task not percentage?", and I've
needed exactly the same thing.

It was answered by Jan De Messemaeker with code as follows:

Dim Job as task
Dim Whodunit as assignment
for each Job in activeproject.tasks
If not Job is nothing then
Job.text7=""
for each whodunit in job.assignments
job.text7=job.text7 & whodunit.resourcename & "(" _
& cstr(whodunit.work/60) & ");"
next whodunit
if len(job.text7)>0 then
job.text7=left(job.text7,(len(job.text7)-1))
end if
end if
next job
end sub

My Problem: I'm utilizing the code for BaselineWork, so have changed the
"whodunit.work" to "whodunit.BaselineWork". BUT I also have Materials in my
schedule and the "/60" part of the code divides my Materials by 60.
I'm brand new to coding, so can anyone tell me - is there a way to utilize,
or alter, this code so it will work for both hours and materials (money)?

The version of Project I use is - Project Standard 2003 (SP1).

Thank you all.
 
J

Jan De Messemaeker

Hi,

Would this do the trick?

Dim Job as task
Dim Whodunit as assignment
dim Sixty as integer
for each Job in activeproject.tasks
If not Job is nothing then
Job.text7=""
for each whodunit in job.assignments
sixty=1
if activeproject.resources(whodunit.resourceid).type=0 then sixty=60
job.text7=job.text7 & whodunit.resourcename & "(" _
& cstr(whodunit.work/sixty) & ");"
next whodunit
if len(job.text7)>0 then
job.text7=left(job.text7,(len(job.text7)-1))
end if
end if
next job


--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
N

nattyboy

Thanks Jan, that worked perfectly :)

Is there a way that it could be changed to only update selected tasks?

The reason I ask is - when I only update a few lines and run the macro it
will run through the whole plan (which is quite large) and so takes a fair
while (10 minutes or so). So maybe if the code was just on selected tasks
then I could select all my tasks when I first run it on a schedule, then use
the same code to only update those tasks that I select if they've been
updated.

If that can be done it would be excellent.
Thanks again for you time.
 

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