EnableCancelKey traps ctrlBreak once, but not twice

J

Jay

Hi - I'm using the following statements (within a procedure) to handle an
interrupt request by the user. It functions properly when the user
interrupts the procedure with the ESCAPE key, but it only functions properly
once if the ctrlBREAK is pressed.

The statements trap and test for Runtime Error = 18 (the errror code for
code interruption). Err=18 both times the ctrlBreak is pressedand the first
time the error is handled properly, but the second time the Excel and the VB
environment (not my error handling statements) stop execution with a "Runtime
Error '18'" dialog with [End] [Debug] buttons.

On Error GoTo userInterrupt
Application.EnableCancelKey=xlErrorHandler
' do stuff here....

userInterrupt:
if err=18 then
' handleerror
resume next
else resume next
end if
end sub
 

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