VBA in Project 2003 - customfield renaming error

R

Roger

customfieldrename seems to work well for renaming the "Friendly name" for
OutlineCodes, but throws an 1101 error when trying to do the same thing for
the customfields.

Works (original name = "myvar"):
application.customfieldrename
fieldid:=pjCustomProjectEnterpriseOutlineCode1, Newname:= "test"

Doesn't work (original name = "Super"):
application.customfieldrename fieldid:=pjCustomProjectEnterpriseText1,
Newname:= "test"

Any Clues?
 
J

Jack Dahlgren

pjCustomrProjectEnterpriseText1 is probably not a valid field ID. In that
line try:

application.customfieldrename fieldid:=FieldNameToFieldConstant(name of your
field here), Newname:= "test"

I don't have time right now to test it, so check it out first.

-Jack Dahlgren
 
R

Roger

Thanks for the response Jack.

Can you provide me an example of where "FieldNameToFieldConstant(name of
your field here)" works?

(I hate this) According to
http://msdn2.microsoft.com/en-us/library/aa193819(office.11).aspx the FieldId
is any member of PjCustomField, which Project Outline Codes and
EnterpriseText are both members.

From other experience w/ extracting & manipulating Outline Codes and
CustomFields, I realize that "one method" doesn't seem to pertain to both
outline codes and custom fields.

For instance, to read the Outline Code "friendly name", you use
Application.GlobalOutlineCodes, whereas for the Custom Fields you use
Application.CustomFieldGetName instead. This makes me think that these are
NOT members of same object collection, and therefore the renaming command may
be different (I haven't had any luck in determining what that "other command"
may be).

Another obvious difference is when you write members to the Outline Codes
which use Application.LookupTable.AddChild vs. Custom Codes that use
Application.CustomFieldValueListAdd. To me this is more obvious since
LookupTables are within scope of the Outline Codes, and ValueLists are within
scope of the Custom Codes.

I am using the same FieldID for my attempt at "renaming" as I use in
CustomFieldGetName, which correctly returns the name for the Custom Field
entry ("Super").

All help is appreciated.
 

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