Marko said:
Hi John,
I got someone to knock up the macro below and it has succeeded in enabling
me to add the custom columns in resource usage view. However, when I run it,
it only seems to populate the info on the very first line (against the
resource.) All the tasks are listed below but the rest of the fields
associated with them are empty. The tasks are also strangely listed under the
resource name column. Nearly there, so a bit frustrating! Any suggestions
appreciated.
...
Dim t As Task
Dim r As Resource
On Error Resume Next
For Each t In ActiveProject.Tasks
For Each r In t.Resources
r.Text1 = t.Text1
r.Text2 = t.Text2
r.Text3 = t.Text3
r.Text4 = t.Text4
r.Text5 = t.Text5
r.Text6 = t.Text6
r.Text7 = t.Text7
Next r
Next t
--------------
Marko,
"Knock up"? That's an interesting way to describe someone creating VBA
code. "Knock out" perhaps, but "knock up"?
I thought I clarified the difference between Tasks, Resources and
Assignments but I guess I didn't go far enough. What you see on the
Resource Usage view are Resources and Assignments, not Resources and
Tasks. Although it is a fine point it is very pertinent to what you want
to do. The code has successfully copied Task text field information to
equivalent Resource text fields and that is all you see. In addition the
Task text information needs to be copied to the Assignment text fields.
This point is perhaps made a little more confusing by the fact that the
column heading simply says "Textx". What it really means is that on
Resource rows, it is Resource Textx and on Assignment rows, it is
Assignment Textx.
The Usage views are hybrid views consisting of either Tasks and
[resource] Assignments or Resources and [task] Assignments. However,
Project's views only allow a single row for column definition. In the
Resource Usage view, for example, the primary field is Resources so the
column heading is Resource Name. The fact the Project also allows the
user to see Assignments in this view is bonus information. I guess the
programmers could have added a separate column identifier but then I
guess they felt it was obvious so why bother. (I tend to disagree on the
"obvious" assumption since many users have a difficult time
understanding the difference between Tasks, Resources, and Assignments).
Hope this helps.
John
Project MVP