Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

How to change the field name within MS Project 2007 using VBA

$
0
0

I am a newbie to MS Project, but not necessarily VBA.  I have built numerous scripts to do numerous tasks in Word, Excel, and Powerpoint.  However, I have been tasked to create a script in MS Project, an application that I have never used before. 

Normally, in Excel, I would simply obtain the column title by using the following:

myvariable = ActiveSheet.Cells(1, x).Value

However, I can see that MS Project has essentially 2 names for every field (column).  They have the standard (Text1, Text 9, Number1, Number7, etc.) and they have the custom field name (My Data, Day of Week, EV, June, etc.)  I would like to know how I would go about using VBA to see the custom name as well as the default name of each field (column).  I prefer using MsgBox to see values that I need. 

I have figured out how to change the values within the table, but not the headers of the table.  This seems to work for changing values within the table:

Dim pj As Project
Set pj = ActiveProject

For Each t In pj.Tasks
    MsgBox t.GetField(FieldNameToFieldConstant("Number1"))  '<---Enter the default field name between quotes
Next t

Best Regards...


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>