Eric,
I recently had a need to do exactly what you require --- list all available built-in and custom fields in Project 2007, showing which are used. This is similar to what you see when you attempt to insert a column into an MS Project table. Unfortunately, the only way I was able to accomplish it was by using the full range of "constants" that MS Project uses. I looked them up and subtracted from the ranges all Enterprise fields (which are a legacy from Project 2003 Server).
I believe the following code will give you just what you're looking for:
ListFields(188743680, 188744278)
ListFields(188744799, 188744808)
ListFields(188744819, 188744956)
Private Sub ListFields(ByVal x As Long, ByVal y As Long)
For i = x To y
If Not IsNull(Application.FieldConstantToFieldName(i)) Then
If Application.FieldConstantToFieldName(i) <> "" Then
If Application.CustomFieldGetName(i) <> "" Then
LocalCustomFields.AddItem (Application.FieldConstantToFieldName(i) & " ( " & Application.CustomFieldGetName(i) & " )")
Else
LocalCustomFields.AddItem (Application.FieldConstantToFieldName(i))
End If
End If
End If
Next
End Sub
LocalCustomFields is your menu control (or some other element of your form such as a listbox). Also, I've adapted this from VB.NET, where I was using sorted lists to automatically put the results in order, so you're going to have to alphabetize what is returned. I think this should get you close, though.
EricG wrote:
Enumerate Fields?
15-Feb-10
Is there an easy way in VBA to enumerate all the available fields (names,
aliases) in MS Project (i.e. "Number1", "Text2", "Start", etc) and their
types (long, boolean, etc)?
Thanks in advance for you help,
Eric
Previous Posts In This Thread:
Submitted via EggHeadCafe - Software Developer Portal of Choice
SharePoint List Usage and Statistics
http://www.eggheadcafe.com/tutorial...d-9723a79fdb14/sharepoint-list-usage-and.aspx