microsoft project 2010: failed to set field value when custom field has formula settings

StackOverflow https://stackoverflow.com/questions/20677048

  •  19-09-2022
  •  | 
  •  

質問

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?

役に立ちましたか?

解決

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.

他のヒント

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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top