Thread: Vista -vs- XP
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Vista -vs- XP

Reading your OP again the problem is, if anything, even worse for me. You
said "the program is still executing" even though the app is marked "not
responding". That's not the case for me, I need to quit Excel from the Task
manager (ctrl-alt-del).

I've had another look and, strangely, even a DoEvents every 3-5 seconds in
the loop also seems enough to fix. At least it does for me in the
following -

Sub test()
Dim b As Boolean, i As Long
' press Esc to abort

' in Vista prepare to crash Excel and close with ctrl-Alt-Del

Range("A1").Formula = "=1 * B1"
Range("B1").Value = 1

Application.Calculation = xlCalculationManual
On Error GoTo errH
Application.EnableCancelKey = xlErrorHandler
b = True
While b = True
Range("C1") = Range("C1") + 1

' Application.Calculate '' uncomment to work around in Vista
'' or try a DoEvents
' DoEvents

For i = 1 To 12345 ' also try i = 1 To 123456
Range("B1") = i
Next
Wend

done:
Application.EnableCancelKey = xlInterrupt
Application.Calculation = xlCalculationAutomatic
Exit Sub
errH:
Resume done
End Sub


The above should run a continuous loop until aborted with Esc. Before trying
in Vista ensure all work is saved (incl non-Excel app's)

Whilst it might seem tempting to use DoEvents in preference to
app.calculate, allowing user to do something mid loop might cause even more
problems, eg manually entering a value in a cell.

Neither you (Bill) nor I are using Excel 2007 which hopefully does not
manifest the same problem in Vista.

Regards,
Peter T


"Bill Martin" wrote in message
...
Interesting. That's a whole lot faster than toggling the mode on/off.

Curiously, I don't find any of the other Application statements that
seem to keep Vista alive other than the various Calculation ones.

Thanks.

Bill
----------------------
On Wed, 1 Oct 2008 00:13:04 +0100, "Peter T" <peter_t@discussions
wrote:

I found simply doing "Application.Calculate" roughly every 5 seconds is
enough to prevent the crash, slotted into the loop appropriately.

I'll let you know if I stumble into something.


I'll also look into it.

Regards,
Peter T