MS Project 2013 – Access and Update Enterprise Project Columns

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.

Advertisements

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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