LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default EnableCancelKey with On Error Resume Next

Hi,

I want to brute force errors in a long loop with
On Error.Resume Next

But I also want to give user a chance to Ctrl Break and
clean up in an orderly way.

Variations on the following seem to work intermittently
but unreliably (.EnableCancelKey = xlErrorHandler inside
the loop slightly more reliable):

Sub ErrorTest()

With Application
For i = 1 To 100000
On Error GoTo ErrH
.EnableCancelKey = xlErrorHandler
'sometimes catches Ctrl Break here

On Error Resume Next
'don't want to break here
.EnableCancelKey = xlDisabled
x = 1 / 0 ' allow this error
Next

ErrH:
.EnableCancelKey = xlInterrupt
End With

MsgBox i & " Err " & Err.Number '18 = user Ctrl Break
End Sub

Not sure if what I'm trying to achieve is possible but any
solution appreciated.

TIA,
Paul


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
On error resume next not working cluckers Excel Discussion (Misc queries) 3 November 25th 09 08:12 PM
On error resume next statement ignored! J S Excel Programming 2 January 30th 04 10:58 PM
ON ERROR RESUME NEXT D.S.[_3_] Excel Programming 7 December 1st 03 09:40 AM
On Error Resume Next D.S.[_3_] Excel Programming 1 November 28th 03 04:52 PM
On Error Resume Next Mike[_58_] Excel Programming 3 November 23rd 03 05:09 PM


All times are GMT +1. The time now is 03:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"