Error handling

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
 
B

Bob Phillips

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top