Excel 2010 screaming loop problem

J

John Jones

I am running Excel 2010 under windows 7 64 bit home premium.

I occasionally (ahem) make mistakes within VBA so that it enters a
screaming loop.

Sometimes I can break in with the pause/break key. But when the loop is
tight Excel greys out and task manager has to be invoked to kill it.

I wrote a test as follows:
Sub test()
' investigate screaming loop problem
Dim i As Integer
Application.EnableCancelKey = xlErrorHandler

i = 0
While i = 0
i = 0
Wend
End Sub

I find that I can set this off and break into it.

Unless I click on the active window first.

The only other thing is that I have the Xnumbers add-in installed but
not activated. I know that this does some dodgy things with the enable
cancel key setting but it should be ok if not currently active?

(BTW Xnumbers is a free mathematical toolpack which I find useful.)

Can anyone help?
Cheers
JJ
 
P

Philip Herlihy

I am running Excel 2010 under windows 7 64 bit home premium.

I occasionally (ahem) make mistakes within VBA so that it enters a
screaming loop.

Sometimes I can break in with the pause/break key. But when the loop is
tight Excel greys out and task manager has to be invoked to kill it.

I wrote a test as follows:
Sub test()
' investigate screaming loop problem
Dim i As Integer
Application.EnableCancelKey = xlErrorHandler

i = 0
While i = 0
i = 0
Wend
End Sub

I find that I can set this off and break into it.

Unless I click on the active window first.

The only other thing is that I have the Xnumbers add-in installed but
not activated. I know that this does some dodgy things with the enable
cancel key setting but it should be ok if not currently active?

(BTW Xnumbers is a free mathematical toolpack which I find useful.)

Can anyone help?
Cheers
JJ

Look up the DoEvents function in Help. This passes control back to
Windows for long enough for Windows to respond to events outside the
application. It will have a 'cost' in processing terms, so it's
typically invoked every second rather than every microsecond.

Note that you'll probably get more replies on a topic like this from a
VBA newsgroup - I'm seeing this in a Windows 7 one!
 

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