Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

VBA Macro Help - Cost Rate Tables

$
0
0

Hello everyone. I am in need of some help. I am not a VBA user, but I am hacking my way through it. The code below has taken me two days to figure out and make it work, so that's what you are dealing with. I am using MSProj 2010 PRO, standalone and I have some code here that is designed to change a resources rate table for a specific client. This code works, but only by the resource name so I need some additional help please. Here is the code that works based on name;

' Macro NOVA_Rates adds new rate information to the Cost Rate Table for a given "name" of resource
Sub NOVA_Rates()
Dim NOVA As CostRateTable
'' The following line sets the resource
Set NOVA = ActiveProject.Resources("Gina").CostRateTables("B")
    ''The following line sets the Cost Rate Table A,B,C,D, or E with a payrate effective date DD/MM/YYYY, StdCost, OTCost, Per Use Cost
ActiveProject.Resources("Gina").CostRateTables("B").PayRates.Add "7/2/2011", "$276/h", "$1000/h", "$0"

End Sub

 

Here is what I need help with. I have "Text1" column (renamed 'Resource Level') with some resource type information, such as "Project Manager", "Engineer", etc. I would like to have this code read the column "Text1" and based on the text, it would determine which set of rates need to go into the Cost Rate Table "B".

For example:

1 - if "Text1" = "Project Manager", then it would use  ("Project Manager").CostRateTables("B").PayRates.Add "7/2/2011", "$1/h", "$5/h", "$0"

2 - if "Text1" = "Electrical Engineer", then it would use  ("Electrical").CostRateTables("B").PayRates.Add "7/2/2011", "$2/h", "$6/h", "$0"

3 - if "Text1" = "Mechanical Engineer", then it would use  ("Mechanical").CostRateTables("B").PayRates.Add "7/2/2011", "$3/h", "$7/h", "$0"

If you could anotate it similar to the way I have, that would be great!

Thanks

Mike

 

 


Viewing all articles
Browse latest Browse all 5347

Trending Articles