A
Adel
ehile trying to update the value of cost for Task # 1 in MS project, I got
the following Error (the argument value is not valid) when executing
the command
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskCost,
"1000000")
The code
Dim x As Integer
Dim PrjFileName As String
Dim objPrj As MSProject.Application
Dim filename As String
objPrj = New MSProject.Application 'Create an instance
With DataSet11.Tables(0)
PrjFileName = .Rows(0).Item(1)
Call objPrj.Alerts(False)
objPrj.DisplayAlerts = False
objPrj.FileOpen(Name:=PrjFileName, ReadOnly:=False,
UserID:="<USERID>", DatabasePassWord:="<PASSWORD>", noAuto:=True, openPool:=4)
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskCost,
"1000000")
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskStart,
"1/1/2001")
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskFinish, "1/1/2002")
the following Error (the argument value is not valid) when executing
the command
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskCost,
"1000000")
The code
Dim x As Integer
Dim PrjFileName As String
Dim objPrj As MSProject.Application
Dim filename As String
objPrj = New MSProject.Application 'Create an instance
With DataSet11.Tables(0)
PrjFileName = .Rows(0).Item(1)
Call objPrj.Alerts(False)
objPrj.DisplayAlerts = False
objPrj.FileOpen(Name:=PrjFileName, ReadOnly:=False,
UserID:="<USERID>", DatabasePassWord:="<PASSWORD>", noAuto:=True, openPool:=4)
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskCost,
"1000000")
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskStart,
"1/1/2001")
objPrj.Projects(PrjFileName).Tasks(0).SetField(MSProject.PjField.pjTaskFinish, "1/1/2002")