Project 2003 Auto-Calculation Problem

B

Bill Bordiuk

Why does Project 2003 (SP2 if it matters) recalculate when you update a task
field (flag, number or text, I've tried them all). Set Project into
Automatic Calculation mode and run the following code:

Sub tst()
Dim t As Task, t0 As Single, i As Integer
t0 = Timer
For Each t In ActiveProject.Tasks
t.Flag16 = Not t.Flag16
Debug.Print "i=" & t.ID & " t=" & Format(Timer - t0, "000.0000")
Next
Debug.Print "Elapsed=" & Format(Timer - t0, "000.0000")
End Sub

Set the Calc mode to Manual and run the code again. In my experience the
code runs over 100 times slower in Autocalc mode leading me to believe that
Project is recalculating after each flag change.

Do you have the same experience? Is there some reason for this? Is there a
work-around? I have a process that needs to update task flags to update the
Gantt display after each calculation and it is unreasonable for a user to
have to wait 80 to 90 seconds for the screen to update every time he changes
a task duration. This does not happen in Project 2000 or 2002, by the way.

Bill Bordiuk
 
R

Rod Gill

Project is recalculating because formulae could rely on the value in the
field, so it gets recalculated. That's a large project if it takes 80-90
seconds to recalculate.

In VBA simply set recalculate mode to manual at the beginning of the macro
then to Auto at the end.

For manual edits set calc to manual and press F9 to recalculate when you
want it to.
 
J

John

Bill Bordiuk said:
Why does Project 2003 (SP2 if it matters) recalculate when you update a task
field (flag, number or text, I've tried them all). Set Project into
Automatic Calculation mode and run the following code:

Sub tst()
Dim t As Task, t0 As Single, i As Integer
t0 = Timer
For Each t In ActiveProject.Tasks
t.Flag16 = Not t.Flag16
Debug.Print "i=" & t.ID & " t=" & Format(Timer - t0, "000.0000")
Next
Debug.Print "Elapsed=" & Format(Timer - t0, "000.0000")
End Sub

Set the Calc mode to Manual and run the code again. In my experience the
code runs over 100 times slower in Autocalc mode leading me to believe that
Project is recalculating after each flag change.

Do you have the same experience? Is there some reason for this? Is there a
work-around? I have a process that needs to update task flags to update the
Gantt display after each calculation and it is unreasonable for a user to
have to wait 80 to 90 seconds for the screen to update every time he changes
a task duration. This does not happen in Project 2000 or 2002, by the way.

Bill Bordiuk

Bill,
I tried your code on a 133 task file I have. I ran it using both Project
2000 SR-1 and Project 2003 Pro with SP2. Here are the tabulated results:

Project 2000 SR-1
Calculation Auto: 2.16 sec
Calculation Manual: 1.97 sec

Project 2003 SP2
Calculation Auto: 2.18 sec
Calculation Manual: 2.12 sec

Results are obviously very close and nowhere near the factor of 100 you
experienced. By the way, I run Project on an emulated PC (Virtual PC) so
my absolute execution times for all VBA macros is considerably slower
than with a normal PC.

Any time a change is made to a project file, Project will re-calculate,
(assuming calculation is set to auto), but I don't know why you are
experiencing the great difference in run times. Nonetheless here are
some thing to look at:
1. Try running the code on a different file, perhaps a new file with
just a few hundred lines. If it runs noticeably faster, your test file
may be corrupt. To address file corruption, go to our MVP website at:
http://www.mvps.org/project/faqs.htm
and take a look at FAQ 43 - File Bloat? Might be corruption.
2. On the off chance that there is a problem with your installation of
Project 2003 itself, try running Detect and Repair.
3. Check your test file to insure other major changes (i.e. date shifts)
are not occurring, even though you are only intending to toggle the flag
field.
4. If your file is extremely large (e.g. a consolidated master with
multiple large subprojects), you may simply need to set calculation to
manual while your macro runs and then do one calculation at the end.
5. Does your file have lots of external links or do you use Paste Links
in the file? Either of those can really have an impact on calculation
time.

Hope this helps.
John
Project MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top