MS Project VBA Project Properties

Today I tried to access and update Enterprise project columns 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.

Get Enterprise Project Properties/Columns

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))

Update Enterprise Project Properties

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.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: