Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
other
informationbridge
office.intranets
office.misc
office.setup
office.xml
officeupdate
onenote
photodraw.discussion
powerpoint
producer
proj.standard&server
project
project.developer
project.pro_and_serve
project.server
project.vba
project2000
publisher
publisher.prepress
publisher.programming
publisher.webdesign
visio
visio.createshapes
visio.database.modeling
visio.dev.diagrams
visio.dev.shapesheet
visio.dev.vba
visio.dev.vc
visio.developer
visio.general
visio.installation
visio.printing
visio.software.modeling
visio.troubleshoot
  
 
date: Mon, 18 Aug 2008 06:55:43 -0700 (PDT),    group: microsoft.public.project.developer        back       


Cost rate change.....   
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: Mon, 18 Aug 2008 06:55:43 -0700 (PDT)   author:   Vit

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

Re: Cost rate change.....   
Thanks Rod and  John...

very happy with this solution....

just one question.... what about if I insert a rate for month????
should be $100.00/Mo.... right??? (because "/m" should be minutes....)

in this case it will work??? I'm not sure......

thank again

Vit
date: Tue, 19 Aug 2008 20:05:30 -0700 (PDT)   author:   Vit

Re: Cost rate change.....   
That would work with my code, but it's not recommended as Months in Project 
are just 20 working days. it is more accurate to use h, d, w or y

-- 

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com



"Vit"  wrote in message 
news:5e964a16-f2c1-4c5b-b896-5822e4280b78@a3g2000prm.googlegroups.com...
> Thanks Rod and  John...
>
> very happy with this solution....
>
> just one question.... what about if I insert a rate for month????
> should be $100.00/Mo.... right??? (because "/m" should be minutes....)
>
> in this case it will work??? I'm not sure......
>
> thank again
>
> Vit
date: Wed, 20 Aug 2008 16:06:48 +1200   author:   Rod Gill rodATproject-systemsDOTcoDOTnz

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us