|
|
|
date: Mon, 18 Aug 2008 06:55:43 -0700 (PDT),
group: microsoft.public.project.developer
back
Re: Cost rate change.....
In article
,
Vit wrote:
> Hi All,
>
> I have to write some VBA code to automatically increase (or decrease)
> the coste rate....
>
> when I read the value with the following, I have to store it as a
> string, so if I'd like to increase it of 10%, i'm not able:
>
> ActiveProject.Resource.CostRateTables("A").PayRates(1).StandardRate
>
> How can I increase it by a percentage????
>
> any other sugestion???
>
> I'd like to automatically increase the value of the the cost rate of a
> right percentage...
>
> thanks all
>
> Vit
Vit,
This may be an obvious detail, but the line of code you show will not
work. It needs to be something like:
ActiveProject.Resources(1).CostRateTables("A").PayRates(1).StandardRate
The following code will give you what you need:
Sub RateEscalate()
Dim r As Resource
For Each r In activeproject.Resources
ResRat = r.CostRateTables("A").PayRates(1).StandardRate
conv = Mid(ResRat, 2, InStr(1, ResRat, "/") - 2)
r.CostRateTables("A").PayRates(1).StandardRate = conv * 1.1
Next r
End Sub
John
Project MVP
date: Mon, 18 Aug 2008 13:12:32 -0700
author: John
Re: Cost rate change.....
Hi,
The following works:
Sub test()
Dim Rate As Currency
Dim Res As Resource
Dim str As String
For Each Res In ActiveProject.Resources
If Not Res Is Nothing Then
str = Res.CostRateTables("A").PayRates(1).StandardRate
Rate = Val(Mid(str, 2))
Res.CostRateTables("A").PayRates.Add Date, Rate * 1.1 &
Right(str, 2)
End If
Next Res
End Sub
The code handles resources on different rate timescales (EG /d or /h).
--
Rod Gill
Microsoft MVP for Project
Author of the only book on Project VBA, see:
http://www.projectvbabook.com
"Vit" wrote in message
news:d22b1456-8402-4dcc-877d-d71bd4257214@z6g2000pre.googlegroups.com...
> Hi All,
>
> I have to write some VBA code to automatically increase (or decrease)
> the coste rate....
>
> when I read the value with the following, I have to store it as a
> string, so if I'd like to increase it of 10%, i'm not able:
>
> ActiveProject.Resource.CostRateTables("A").PayRates(1).StandardRate
>
> How can I increase it by a percentage????
>
> any other sugestion???
>
> I'd like to automatically increase the value of the the cost rate of a
> right percentage...
>
> thanks all
>
> Vit
date: Tue, 19 Aug 2008 08:16:40 +1200
author: Rod Gill rodATproject-systemsDOTcoDOTnz
|
|