ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ERROR HANDLING (https://www.excelbanter.com/excel-programming/425226-error-handling.html)

Brettjg

ERROR HANDLING
 
Just trying to write a little error handler. On the first occurence of the
error it goes to err_handler nicely, but then I want it to crash n the second
occurence and go to Debug in the usual way, so that the problem line is
highlighted and i can maybe correct it, and continue. What I don't know is
how to set it to crash after the "ELSE".

Windows(xx).Activate
GoTo end_open_proc

err_handler:
If Not err_flag = "Y" Then
Application.EnableEvents = True
Application.Run "PERSONAL.xls!WAV_CRASH"
MsgBox "Error " & Err.Number & " " & Err.Description
err_flag = "Y"
Resume
Else
'what goes here to make it crash on the second occurence of the error?
End If
end_open_proc:

Brettjg

ERROR HANDLING
 
Wait...........I've just worked it out. After the "Else" put
On Error goto 0
Resume

"Brettjg" wrote:

Just trying to write a little error handler. On the first occurence of the
error it goes to err_handler nicely, but then I want it to crash n the second
occurence and go to Debug in the usual way, so that the problem line is
highlighted and i can maybe correct it, and continue. What I don't know is
how to set it to crash after the "ELSE".

Windows(xx).Activate
GoTo end_open_proc

err_handler:
If Not err_flag = "Y" Then
Application.EnableEvents = True
Application.Run "PERSONAL.xls!WAV_CRASH"
MsgBox "Error " & Err.Number & " " & Err.Description
err_flag = "Y"
Resume
Else
'what goes here to make it crash on the second occurence of the error?
End If
end_open_proc:



All times are GMT +1. The time now is 03:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com