Assign a value to a variable task field

D

draco664

Greetings all,

I have a project which uses several custom text fields for different
things. However, the specified text fields may change at a later
stage, when the new scheduling standards are released, so I want to
just change a constant to identify the field.

I'm trying to write some code that will assign a value to one of the
text fields, which is identified within the code.

I've tried using the getfield function, but I get the compile error
"Function call on left-hand side of assignment must return Variant or
Object."

For example.

' defining constants representing fields
Const CodeFile_ReleaseField = pjCustomTaskText2
Const CodeFile_TeamField = pjCustomTaskText3

' then later within the code
activeproject.tasks(i).getfield(CodeFile_ReleaseField) = "Release 1"
activeproject.tasks(i).getfield(CodeFile_TeamField) = "Build Team"

Any ideas?
 
J

Jack Dahlgren MVP

FieldnametoFieldconstant should give you the constant you want for the
field. You can use the constant anytime you want after that - even - I
think - if the field name changes (not if the field is recreated though.

-Jack Dahlgren
 
B

Bill B

Check out the Help for SetField, as in:

activeproject.tasks(i).setfield(CodeFile_ReleaseField, "Release 1")
 

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