M
mike.mahoney
Hi
I am trying to capture actual hours from last week and store in an
entereprise field, but no matter how I phrase the setfield method I
get an error. Code is below - any suggestions greatly appreciated.
Note Enterprise field LastWeekAct is defined as type Duration
Thanks
Mike
Sub Snapshot()
Dim LastWeekAct As String
Dim FieldRef As String
Dim Tsk As Task
For Each Tsk In ActiveProject.Tasks
If Not Tsk Is Nothing Then ' tests for blank row
LastWeekAct = Tsk.GetField(FieldID:=pjTaskActualWork)
FieldRef = FieldNameToFieldConstant(FieldName:="LastWeekAct",
FieldType:=pjTask)
' Tsk.SetField pjTaskBaseline9Work, LastWeekAct - This line works
' Tsk.SetField
FieldID:=FieldNameToFieldConstant(FieldName:="LastWeekAct",
FieldType:=pjTask), Value:=LastWeekAct _ ' This line fails
' Next line also fails - Run time error 1101 - Argument value is
not valid
Tsk.SetField FieldRef, LastWeekAct
End If
Next Tsk
End Sub
I am trying to capture actual hours from last week and store in an
entereprise field, but no matter how I phrase the setfield method I
get an error. Code is below - any suggestions greatly appreciated.
Note Enterprise field LastWeekAct is defined as type Duration
Thanks
Mike
Sub Snapshot()
Dim LastWeekAct As String
Dim FieldRef As String
Dim Tsk As Task
For Each Tsk In ActiveProject.Tasks
If Not Tsk Is Nothing Then ' tests for blank row
LastWeekAct = Tsk.GetField(FieldID:=pjTaskActualWork)
FieldRef = FieldNameToFieldConstant(FieldName:="LastWeekAct",
FieldType:=pjTask)
' Tsk.SetField pjTaskBaseline9Work, LastWeekAct - This line works
' Tsk.SetField
FieldID:=FieldNameToFieldConstant(FieldName:="LastWeekAct",
FieldType:=pjTask), Value:=LastWeekAct _ ' This line fails
' Next line also fails - Run time error 1101 - Argument value is
not valid
Tsk.SetField FieldRef, LastWeekAct
End If
Next Tsk
End Sub