Today I tried to update project properties through a VBA Macro.

So first of all my project property is called “Master Project” and this is a simple text field. I want this field to contain the name of the master project so that I can display this in my views in Project Web App 2013

In my macros I’m cycling through the sub projects within my master project when I open my master project. The variable subproj is holding the subproject.

Enough background now it’s time to look at the actual updating of the custom Enterprise Project property.

First step – Get the field ID for the Master Project field:

fld = ActiveProject.Application.FieldNameToFieldConstant(“Master Project”, pjProject)

Then get the current value as I don’t want to update it if it has been set before.

FieldVal = subproj.SourceProject.ProjectSummaryTask.GetField(ActiveProject.Application.FieldNameToFieldConstant(“Master Project”, pjProject))

The final step compare if the value has to be changed or not and change it if it has changed:

If FieldVal ActiveProject.Name Then
subproj.SourceProject.ProjectSummaryTask.SetField fld, ActiveProject.Name
End If

Not difficult, but I couldn’t find anywhere to do this. So hopefully somebody will save some time with this article. If you do please let me know.