Error handling

  • Thread starter Thread starter Swingleft
  • Start date Start date
S

Swingleft

Hello,

Now I getting the hang of making small progjes with VB.

I really asked a number of things.

15 years ago, i wrote a lot in LISP for AutoCAD.
I always made a sort of error handler which include all variables to reset,
and
the Prog. to close properly on errors or misuse.

Is there also such a thing in VBA ..

I like to hear.

gr.

SwingLeft
 
Sub MySub()

On Error Goto proc_err_handler:

'an example of something the code might do temporarily
Application.ScreenUpdating = False

'rest of your code

proc_tidy_up:
'tear-down code
Application.ScreenUpdating = True
Exit Sub

proc_err_handler:
'some error reporting, for exampl
MsgBox "Err number: " & err.Number & vbNewline & _
"Err description: " & err.Description
Resume proc_tidy_up
End Sub


Bob
 
Back
Top