Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to identificate an Assignment ?

Status
Not open for further replies.

Bix78

Programmer
Jul 26, 2002
6
CL
Greetings all,

I am currently learning Microsoft Project (working on 2002) as well as VBA so this may be a simple issue, but I get somewhat lost.

Let's imagine we have this scheme showing in the Task Usage page. I am showing here the Task Name and Actual Work columns :

+ Task1...............10 hrs
--- ResourceA.........8 hrs
--- ResourceB.........2 hrs
+ Task2...............5 hrs
--- ResourceB.........5 hrs

I would like to update the Actual Work of a Resource for a given Task, from an external source such as a TXT file.
In this File I would e.g. have :
Code:
Task_Name Resource_Name Actual_Work
Task1 ResourceA 2
Task2 ResourceB 3

and my Task Usage should then show this :
+ Task1...............12 hrs
--- ResourceA.........10 hrs
--- ResourceB.........2 hrs
+ Task2...............8 hrs
--- ResourceB.........8 hrs

For this I see I need to load the Actual_Work vlaue from the TXT file, and add it to the value situated in the Actual Work field.

I have tried this simple macro line :
Code:
MsgBox ("value : " & ActiveCell.Task.GetField(FieldID:=pjTaskName))

... and whatever cell is the "Active" one, it gives correctly the name of the associated Task.

Then I tried this one :
Code:
MsgBox ("value : " & ActiveCell.Resource.GetField(FieldID:=pjResourceName))

.. and it won't work unless I go to the Resource Usage page (this seems totally normal to me hehe).


So : HOW in VBA can I identify :
- the Resource Name in the Task Usage page
or
- the Task Name in the Resource Usage page

In other words : How can I identify in VBA this Assignment link ?
 
Hello Bix78,
Follow this link:
It for the PRJ98: Microsoft Project 98 Visual Basic Environment Manual. If the link above does not work search for: Microsoft Knowledge Base Article - 186077

Although it is for Project 98. I don't think there is much difference in the VBA code.

Hope this helps,
Michael
 
Thanks a lot for this link. The info there is very interesting I hope I will find what I need in it ...

 
Well actually thanksa ton. I found the solution there.

For those who have any interest in the quesiton here is a little For which displays all the Resources and their Assignments :

For Each r In ActiveProject.Resources
strTemp = ""
For Each a In r.Assignments
strTemp = a.TaskName & Sep & strTemp
Next a
MsgBox ("Ressource " & r.Name & " - Assignments : " & strTemp)
Next r

so simple : )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top