R
RC
Hello, I am trying to get assignment Remaining Work timephased data.
Following is that portion of the code. Just to make it clearer, RaTsvs
= assignment Timephased Work, aTsvs = assignment Timephased Actual
Work. What I've done is Work - Actual Work and export to Excel.
My problem is that when the resource type is material, no value is
exported... for some reason, that condition is skipped. Everything
else is correct. Or that's my best guess; I tried a dummy value and it
never shows up. I do have separate code for exporting Work and Actual
Work separately that works for both material and work resource.
Thank you for any assistance!
Set RaTsvs = Asgn.TimeScaleData( _
StartDate:=InputDate, _
EndDate:=ActiveProject.ProjectSummaryTask.Finish,
_
Type:=pjAssignmentTimescaledWork, _
timescaleunit:=pjTimescaleMonths, _
Count:=1)
Set aTsvs = Asgn.TimeScaleData( _
StartDate:=InputDate, _
EndDate:=ActiveProject.ProjectSummaryTask.Finish,
_
Type:=pjAssignmentTimescaledActualWork, _
timescaleunit:=pjTimescaleMonths, _
Count:=1)
countatTsv = 1
For countatTsv = 1 To RaTsvs.Count
If RaTsvs(countatTsv) = "" And
aTsvs(countatTsv) = "" Then
Set xlCol = xlCol.Offset(0, 1)
ElseIf RaTsvs(countatTsv) <> "" And
aTsvs(countatTsv) = "" Then
If Asgn.ResourceType = pjResourceTypeWork
Then
xlCol =
Round((RaTsvs(countatTsv).Value / 60), 2)
ElseIf Asgn.ResourceType =
pjResourceTypeMaterial Then
xlCol = RaTsvs(countatTsv).Value
End If
Set xlCol = xlCol.Offset(0, 1)
ElseIf RtTsvs(countatTsv) <> "" And
aTsvs(countatTsv) <> "" Then
If Asgn.ResourceType = pjResourceTypeWork
Then
xlCol =
Round(((RaTsvs(countatTsv).Value / 60) - (aTsvs(countatTsv).Value /
60)), 2)
ElseIf Asgn.ResourceType =
pjResourceTypeMaterial Then
xlCol =
Round(((RaTsvs(countatTsv).Value) - (aTsvs(countatTsv).Value)), 2)
'xlCol = "TESTtest"
End If
Set xlCol = xlCol.Offset(0, 1)
End If
Next countatTsv
Following is that portion of the code. Just to make it clearer, RaTsvs
= assignment Timephased Work, aTsvs = assignment Timephased Actual
Work. What I've done is Work - Actual Work and export to Excel.
My problem is that when the resource type is material, no value is
exported... for some reason, that condition is skipped. Everything
else is correct. Or that's my best guess; I tried a dummy value and it
never shows up. I do have separate code for exporting Work and Actual
Work separately that works for both material and work resource.
Thank you for any assistance!
Set RaTsvs = Asgn.TimeScaleData( _
StartDate:=InputDate, _
EndDate:=ActiveProject.ProjectSummaryTask.Finish,
_
Type:=pjAssignmentTimescaledWork, _
timescaleunit:=pjTimescaleMonths, _
Count:=1)
Set aTsvs = Asgn.TimeScaleData( _
StartDate:=InputDate, _
EndDate:=ActiveProject.ProjectSummaryTask.Finish,
_
Type:=pjAssignmentTimescaledActualWork, _
timescaleunit:=pjTimescaleMonths, _
Count:=1)
countatTsv = 1
For countatTsv = 1 To RaTsvs.Count
If RaTsvs(countatTsv) = "" And
aTsvs(countatTsv) = "" Then
Set xlCol = xlCol.Offset(0, 1)
ElseIf RaTsvs(countatTsv) <> "" And
aTsvs(countatTsv) = "" Then
If Asgn.ResourceType = pjResourceTypeWork
Then
xlCol =
Round((RaTsvs(countatTsv).Value / 60), 2)
ElseIf Asgn.ResourceType =
pjResourceTypeMaterial Then
xlCol = RaTsvs(countatTsv).Value
End If
Set xlCol = xlCol.Offset(0, 1)
ElseIf RtTsvs(countatTsv) <> "" And
aTsvs(countatTsv) <> "" Then
If Asgn.ResourceType = pjResourceTypeWork
Then
xlCol =
Round(((RaTsvs(countatTsv).Value / 60) - (aTsvs(countatTsv).Value /
60)), 2)
ElseIf Asgn.ResourceType =
pjResourceTypeMaterial Then
xlCol =
Round(((RaTsvs(countatTsv).Value) - (aTsvs(countatTsv).Value)), 2)
'xlCol = "TESTtest"
End If
Set xlCol = xlCol.Offset(0, 1)
End If
Next countatTsv