PRJ: TimeScaledData Method Example Run Time Error 91 |
Q113397
The sample code for the TimeScaledData method in Visual Basic for
Applications Help may produce a "Run Time Error 91" error message when you
use it with projects that contain blank rows.
Under normal circumstances, this macro should run correctly and create a
.CSV file.
The sample code for this macro does not take blank rows into account; therefore, the Run Time error is produced when the macro encounters a blank task row.
To work around this problem, add additional commands to the macro code that will trap the error situation. To trap the error, add "If Not (t is Nothing) then . . . end if" around the For Next loop in the macro. When you add this code, the error will be trapped and the example will run on files with blank task rows. The resulting code example looks like this:
Sub AssignmentsOverTime()
Dim t, r, temp
Open "USAGE.CSV" For Output As #1
For Each t In ActiveProject.Tasks
If Not (t is Nothing) Then 'NEW LINE
Print #1, t.Name
For Each r In t.Resources
temp = TimescaledData(t.ID, r.ID, ActiveProject.ProjectStart, _
ActiveProject.ProjectFinish, pjWork, pjTimescaleWeeks)
Print #1, r.name & ListSeparator & temp
Next r
End If 'NEW LINE
Next t
Close #1
End Sub
Additional query words:
Keywords : kbcode kbprogramming kbofficeprog
Issue type :
Technology : kbHWMAC kbOSMAC kbProjectSearch kbProject400Mac kbProjectMacSearch kbProject400
|
Last Reviewed: March 31, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |