J
JJ
I have a subroutine that removes all cost data while trying to ensure
that no dates are affected. For lack of a better term, it is a "Cost
Strip" subroutine.
The following is a portion of code that I have that works 99% of the
time. But I have a Project file that crashes Project when this code...
when a particular line is executed.
For Each t In allt
If Not (t Is Nothing) Then
If t.ExternalTask = False Then
Set TVALW =
t.TimeScaleData(ActiveProject.ProjectStart - 780, _
ActiveProject.ProjectFinish + 780, _
pjTaskTimescaledBaselineWork, _
pjTimescaleMonths)
Set TVALC =
t.TimeScaleData(ActiveProject.ProjectStart - 780, _
ActiveProject.ProjectFinish + 780, _
pjTaskTimescaledBaselineCost, _
pjTimescaleMonths)
For x = 1 To TVALW.count
If TVALW.Item(x).Value <> "" Then
TVALW.Item(x).Clear
<=== *** ERROR OCCURS HERE ***
End If
Next x
For x = 1 To TVALC.count
If TVALC.Item(x).Value <> "" Then
TVALC.Item(x).Value = 0
End If
Next x
t.BaselineCost = 0
t.BaselineWork = 0
t.Cost1 = 0
t.Cost2 = 0
t.Cost3 = 0
t.Cost4 = 0
t.Cost5 = 0
t.Cost6 = 0
t.Cost7 = 0
t.Cost8 = 0
t.Cost9 = 0
t.Cost10 = 0
t.FixedCost = 0
End If
End If
Next t
I have indicated in the code above where the problem occurs. Can
anyone tell me what would cause this line to crash the entire
application? Is there anything that I need to check that I am not
doing?
I inherited this code from another developer so I only have a basic
understanding of what time-scaled values are in Microsoft Project. Any
help would be greatly appreciated!
Thank!
JJ
that no dates are affected. For lack of a better term, it is a "Cost
Strip" subroutine.
The following is a portion of code that I have that works 99% of the
time. But I have a Project file that crashes Project when this code...
when a particular line is executed.
For Each t In allt
If Not (t Is Nothing) Then
If t.ExternalTask = False Then
Set TVALW =
t.TimeScaleData(ActiveProject.ProjectStart - 780, _
ActiveProject.ProjectFinish + 780, _
pjTaskTimescaledBaselineWork, _
pjTimescaleMonths)
Set TVALC =
t.TimeScaleData(ActiveProject.ProjectStart - 780, _
ActiveProject.ProjectFinish + 780, _
pjTaskTimescaledBaselineCost, _
pjTimescaleMonths)
For x = 1 To TVALW.count
If TVALW.Item(x).Value <> "" Then
TVALW.Item(x).Clear
<=== *** ERROR OCCURS HERE ***
End If
Next x
For x = 1 To TVALC.count
If TVALC.Item(x).Value <> "" Then
TVALC.Item(x).Value = 0
End If
Next x
t.BaselineCost = 0
t.BaselineWork = 0
t.Cost1 = 0
t.Cost2 = 0
t.Cost3 = 0
t.Cost4 = 0
t.Cost5 = 0
t.Cost6 = 0
t.Cost7 = 0
t.Cost8 = 0
t.Cost9 = 0
t.Cost10 = 0
t.FixedCost = 0
End If
End If
Next t
I have indicated in the code above where the problem occurs. Can
anyone tell me what would cause this line to crash the entire
application? Is there anything that I need to check that I am not
doing?
I inherited this code from another developer so I only have a basic
understanding of what time-scaled values are in Microsoft Project. Any
help would be greatly appreciated!
Thank!
JJ