ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error handling (https://www.excelbanter.com/excel-programming/444863-error-handling.html)

Swingleft

Error handling
 
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


Bob Phillips[_4_]

Error handling
 

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

"Swingleft" wrote in message
el.net...
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





All times are GMT +1. The time now is 01:39 AM.

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