I need to use below function in my MS Project vba macro.

Application.CustomFieldValueListAdd FieldID:=lookupfield, Value:=i

It works fine for local field(field created locally in ms project in active project). But it doesn't work for Enterprise Custom Field of Task type. I am able to get id using function FieldNameToFieldConstant("Product_task", pjTask), but it is giving error if I use this generated id in first function. I hope my problem is clear.


So you're trying to add values to the lookup choices for a field? Not set a task field value e.g. a task "text" custom field.

The problem is that you cannot modify an Enterprise Lookup Table in the client, it needs to be done on the server via one of the server APIs.

The method Application.CustomFieldValueListAdd only supports the local fields e.g. those listed: https://docs.microsoft.com/en-us/office/vba/api/project.pjcustomfield

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.