Project 2000 VBA field type

M

manohar

I am trying to get more information about the custom fields of tasks in
Project 2000 when all I have is the PjField enum value for the field.
eg., if I have the PjField enum value (eg., pjTaskDate1) how to get
more information about this field through VBA code. ie., I want to
know:
1. whats the type (date/numeric/cost etc)
2. whats the name (if the default name then Date1 or if its renamed
then the new name)
3. The value (I know I can use GetField but this returns the value in
string which is pretty useless to me because duration type will return
1 Day/1 Week but I want the value stored underneath ie., 480/2400 for 1
day/1 week)

Are there inbuilt methods to do this?
sample code or any pointer in the right direction would be great..!!
thanks a lot in advance
manohar
 
J

John

manohar said:
I am trying to get more information about the custom fields of tasks in
Project 2000 when all I have is the PjField enum value for the field.
eg., if I have the PjField enum value (eg., pjTaskDate1) how to get
more information about this field through VBA code. ie., I want to
know:
1. whats the type (date/numeric/cost etc)
2. whats the name (if the default name then Date1 or if its renamed
then the new name)
3. The value (I know I can use GetField but this returns the value in
string which is pretty useless to me because duration type will return
1 Day/1 Week but I want the value stored underneath ie., 480/2400 for 1
day/1 week)

Are there inbuilt methods to do this?
sample code or any pointer in the right direction would be great..!!
thanks a lot in advance
manohar

manohar,
Here are the answers to your questions
1. You already know the type if you have the pjfield constant. The
example you use, pjTaskDate1, tells you it is a Date type. The same
holds for any other spare fields.
2. If you truly mean a custom field then the name can be obtained with
the CustomFieldGetName Method. If however you simply want to know the
modified name of a spare field, try the FieldName property of a cell
object.
3. There are several ways to get the value of a field depending on how
you code is structured (foreground or background processing). Using the
GetField Method is one of the ways and it is not useless. You simply
have to know how to interpret the information. For example if duration
data is returned as the string "10 days", some string parsing will tell
you that the dimension is days. Then an appropriate factor can be
applied to determine that the 10 days are equivalent to 4800 minutes.

You're there, you just didn't know it.

John
Project MVP
 

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