I’ve done a little VBA (Visual basic for applications) programming lately, and today I ran into a problem, where I wanted to make a simple try catch.
The error occurred because the users put letters instead of numbers into a specified field, so I just wanted to do some simple user validation with try catch.
Apparently, there is no such thing as try catch in VBA.
Instead of try, you have to use the”on error” statement. So a Try Catch will look something like this.
On Error GoTo ErrHandler:
”…The code, where you might get a run time error
” Some error handling code
When an error occurs, the code will jump to the ErrHandler label, and the resume next statement will continue to run the rest of the code.
I guss that is nice to know 🙂