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

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

  •  19-09-2022
  •  | 
  •  

Frage

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?

War es hilfreich?

Lösung

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.

Andere Tipps

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
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top