The Assignment should have a CostRateTable property, which you can
use to look up the rate in the Resource's PayRates collection.
So, given a task called TestTask, which has a resource, TestRes,
assigned to it that has a rate of $100/hr in Cost Table C, the
following code should work:
Option Explicit
Sub Test()
Dim oTask As Task
Dim oAssignment As Assignment
Dim oResource As Resource
Dim oRate As String
Set oTask = ActiveProject.Tasks("TestTask")
Set oAssignment = oTask.Assignments(1)
Set oResource =
ActiveProject.Resources(oAssignment.ResourceName)
oRate = oResource.CostRateTables((oAssignment.CostRateTable +
1)).PayRates(1).StandardRate
Call MsgBox(oRate, vbOKOnly, "Rate")
End Sub
I had to add 1 to the value from Assignment.CostRateTable because
that property is 0-based, while the CostRateTables collection is
1-based.
Please let me know if this works for you.
--
Stephen Sanderlin
Owner/Founder - EPMFAQ
http://www.epmfaq.com/
http://forums.epmfaq.com/
EPM Solutions Architect / Principal Consultant - BT Professional
Services
http://bt.ins.com/
This electronic message, along with any information, advice, and
opinions it contains, are mine alone and are not representative of
my employer. All information is provided in "GOOD FAITH" and on an
"AS IS" basis only. I provide no presentations or warranties,
express or implied, including implied warranties of fitness for a
particular purpose, merchantability, title, and noninfringement. I
strongly advise you to extensively test any changes, workarounds,
or techniques described herein on a development system prior to
implementation in a production environment, and you are hereby
notified that I bear no responsibility whatsoever for any loss,
harm, or otherwise negative outcomes resulting from your actions,
whether or not said actions were a result of this electronic
message, directly or indirectly.