0
votes

I have a question about setting a field value in Microsoft Project 2010. A custom field(text25) has formula settings, which is

IIf([Baseline Estimated Start]=projdatevalue("NA"),"",Format([Baseline Estimated Start],"YYYY-MM-DD"))

when I using Microsoft API to set this field's value, the code is as following, MSPField is the field with the formula setting.

MSProject.Task.SetField(MSPField, value);

This code will cause an exception:

System.Runtime.InteropServices.COMException (0x800A044D): The argument value is not valid.at Microsoft.Office.Interop.MSProject.Task.SetField(PjField FieldID, String Value)

How to fix this issue?

2

2 Answers

0
votes

By definition, fields that have formulas are read-only. Either remove the formula from the Text25 field or don't try to set the value.

0
votes

Before you do task.setfield, you can switch off any formula that may have been applied to the field with the following:

Application.CustomFieldProperties MSPField, Attribute:=pjFieldAttributeNone, summarycalc:=pjCalcNone