Copy in text field in Gantt view to a new text field in Resource U

P

Peter Rooney

Apologies to Mr Messemaeker for hacking his code into a non-working format!

I have a text field in my Gantt view that I want to show in my Resource
usage view.
Last week, Jan kindly gave me some code to display Duration in Resource
Usage view, which I thought I'd modified to do what I want - but not quite..!
The field in Gantt View I want to bring in is Text9, AKA "CR/TWR"
The field in Resource Usage I want to bring the information into is Text1

Sub AssignTWR()
Dim Job As Task
Dim MyTask As Assignment
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
For Each MyTask In Job.Assignments
MyTask.Text1 = MyTask.Text9
Next MyTask
End If
Next Job
End Sub

I know whay this doesn't do anything - it makes Text1 in Resource Usage
equal Text9 in Resource Usage, - as the latter is empty, Text1 stays empty,
too! - I want it to equal Text9 from the Gannt view!

Cheers

Pete
 
J

Jan De Messemaeker

Hi Peter,
I'm afraid you missed the pioint.
Whatever text field you manipulate you have to create a ASSIGNMENT FIELD.
Therse are visble in both Usage views.
A Task field is NOT a resource field and will never be.
Get back to my code anfd start again with this in mind.
Key is to copy into an ASSIGNMENT field;
HTH
 
J

John

Peter Rooney said:
Sub AssignTWR()
Dim Job As Task
Dim MyTask As Assignment
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
For Each MyTask In Job.Assignments
MyTask.Text1 = MyTask.Text9
Next MyTask
End If
Next Job
End Sub

Pete,
You are almost there. Change the "working line" to:
MyTask.Text1 = Job.Text9

Hope this helps.
John
Project MVP
 
P

Peter Rooney

John,

Why does it always make perfect sense when somebody tells you the answer!
This works just fine, and more importantly, I can see why, too!

Thanks again

Pete
 
P

Peter Rooney

Jan,

Thanks for pointing this out. I think I understood the concept of assignment
fields - I just didn't know how to reference the contents of Text9 in the
Gantt view. I've got it sorted now!
Thanks for your patience and for coming back to me!

Regards

Pete
 
J

John

Peter Rooney said:
John,

Why does it always make perfect sense when somebody tells you the answer!
This works just fine, and more importantly, I can see why, too!

Thanks again

Pete


Pete,
It is always a bonus when something works AND the light goes on too.

You're welcome.
John
 

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