Macro question

A

Anonymous

Is there any way to set the value of project custom field(Number13) through
VBA code? I need this to store the week before SPI value. Later i will use it
to display in a view. Everytime the project is saved this macro will run and
update the value of Number 13 field. Project data will change on weekly
basis. Any ideas? See the code snippet below.

Private Sub Project_BeforeSave(ByVal pj As Project)

pj.StatusDate = DateSubtract(pj.CurrentDate, "14d")

PROJECT CUSTOM FIELD Number 13 = IIf([BCWS] = 0, 1, SPI)

pj.StatusDate = pj.CurrentDate

End Sub
 
B

Brian K - Project MVP

Anonymous said:
Is there any way to set the value of project custom field(Number13)
through VBA code? I need this to store the week before SPI value.
Later i will use it to display in a view. Everytime the project is
saved this macro will run and update the value of Number 13 field.
Project data will change on weekly basis. Any ideas? See the code
snippet below.


Try this...but test it first as Im not 100% sure this is what you are
asking for..

Private Sub Project_BeforeSave(ByVal pj As Project)

pj.StatusDate = DateSubtract(pj.CurrentDate, "14d")

If pj.ProjectSummaryTask.BCWS = 0 Then
pj.ProjectSummaryTask.Number13 = 1
Else
pj.ProjectSummaryTask.Number13 = pj.ProjectSummaryTask.SPI
End If


pj.StatusDate = pj.CurrentDate

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top