I am handling errors with the
on error goto
statement, and when the error processing is activated, I wish to handle the errors something like this...
If Err.Number = this Then
do_this
ElseIf Err.Number = that Then
do_that
Else
do_the_other
End If
To do this, though, relies on knowing what errors generate which numbers. Is there a list of these anywhere (I have been unable to find one)?
Visual Basic can generate custom errors of any data type, including Exception objects, by using the Throw statement. An application can identify the error by displaying the error number and message of a caught exception. If an error isn't caught, the application ends. The code can trap and examine run-time errors.
Applies to: Visual Studio Visual Studio for Mac Visual Studio Code. Note. The Error List displays information about a specific error message. You can copy the error number or error string text from the Output window. To display the Output window, press Ctrl+Alt+O.
The Visual Basic error handling model allows programmers to perform special actions when an error occurs, such as jumping to a particular line of code.
Here are the core Visual Basic 6.0 language errors:
Trappable Errors - Visual Basic for Applications Reference - Visual Studio 6.0
Searching for "Trappable errors" also produces such list for VS 2008 (i.e. Office 2007) and a list for an unspecified version dated 2006 (so must be Office 2003).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With