VBA Read Custom Field Name

S

ScoobyDon

BACKGROUND: I have constructed a high level 8Q schedule for some executives
with little knowledge of MS Project. With the combinition of some code and
forms I have made the importing / mapping from their Excel file to Project
painless and mindless. I have also written code to perform all the custom
formatting they desire.

QUESTION: With VBA how do I read the name of a local custom field? So, let's
say I have renamed the Cost4 field to "2009 Q3 Budget". With the limited
number of available customizable cost fields, as the year advances the Cost4
field may be renamed to "2011 Q3 Budget" to keep forward progress of an 8Q
look for upcoming work.

I need to be able to test what the Cost4 field rename value is for
formatting and field setting purposes.

Here is an OUTLINE (I do understand this is not correct for what I am trying
to do, nor is it even trying to be correct, it's just an OUTLINE) of the code
structure I am looking for

If Cost4 Name = "2009 Q3 Budget" Then
'Do STUFF
End If

Can anyone help me here?
 
R

Rod Gill

Hi,

Try:
If CustomFieldGetName(pjCustomTaskCost4)="2009 Q3 Budget" then

Or:
Select Case CustomFieldGetName(pjCustomTaskCost4)
case "2009 Q3 Budget"
'---
case "2009 Q4 Budget"
'---
End Select
--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
S

ScoobyDon

Thanks a million!

I was able to set functionaility around checking the current date and
renaming the Cost fields based on a date range, then look at what the Cost
fields are named to dictate what quarterly budget numbers to import.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top