Thread: Error handling
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default 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