Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error handling
(excel 2000, 2003, 2007)
Hello All I have a function where I want the error handling for the most part to be On Error GoTo HandleError but for certain blocks I want it to be On Error Resume Next How do I do this? Regards GPO |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error handling
Just switch between the two errors mode as required
On Error GoTo HandleError 'section 1 code On Error Resume Next 'section 2 code On Error GoTo HandleError 'section 3 code "GPO" wrote: (excel 2000, 2003, 2007) Hello All I have a function where I want the error handling for the most part to be On Error GoTo HandleError but for certain blocks I want it to be On Error Resume Next How do I do this? Regards GPO |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error handling
I tend to handle that by placing the Resume Next code into a separate
procedure, as the error handler is reset on exit. Sub TestError() On Error GoTo HandleError 'do stuff Call CalledProc Debug.Print 1 / 0 Exit Sub HandleError: MsgBox Err.Number & " : " & Err.Description End Sub Function CalledProc() On Error Resume Next Debug.Print 1 / 0 End Function It may seem unnecessary, but I find it keeps the code more structured, and gives m e all the control that I need -- __________________________________ HTH Bob "GPO" wrote in message ... (excel 2000, 2003, 2007) Hello All I have a function where I want the error handling for the most part to be On Error GoTo HandleError but for certain blocks I want it to be On Error Resume Next How do I do this? Regards GPO |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error handling error # 1004 Run-time error | Excel Programming | |||
Set Error handling INSIDE error-trap | Excel Programming | |||
Error Handling - On Error GoTo doesn't trap error successfully | Excel Programming | |||
Error handling. | Excel Programming | |||
Error handling with a handling routine | Excel Programming |