Some stuff to save for prosperity, related to this main forum post https://eileenslounge.com/viewtopic....315229#p315229
https://eileenslounge.com/viewtopic....315235#p315235
Some Microsoft documentation as of March 2024, here: https://learn.microsoft.com/en-us/of...rror-statement ( Just some of the first bits, relevant to the discussion at https://eileenslounge.com/viewtopic.php?f=30&t=40752 )
On Error statement Article 03/30/2022
Syntax
On Error GoTo line
On Error Resume Next
On Error GoTo 0
The On Error statement syntax can have any of the following forms:
Statement |
Description |
On Error GoTo line |
Enables the error-handling routine that starts at line specified in the required line argument.
The line argument is any line label or line number.
If a run-time error occurs, control branches to line, making the error handler active.
The specified line must be in the same procedure as the On Error statement; otherwise, a compile-time error occurs. |
On Error Resume Next |
Specifies that when a run-time error occurs, control goes to the statement immediately following the statement where the error occurred and execution continues. Use this form rather than On Error GoTo when accessing objects. |
On Error GoTo 0 |
Disables any enabled error handler in the current procedure. |
Remarks
If you don't use an On Error statement, any run-time error that occurs is fatal; that is, an error message is displayed and execution stops.
An "enabled" error handler is one that is turned on by an On Error statement; an "active" error handler is an enabled handler that is in the process of handling an error. If an error occurs while an error handler is active (between the occurrence of the error and a Resume, Exit Sub, Exit Function, or Exit Property statement), the current procedure's error handler can't handle the error. Control returns to the calling procedure.
If the calling procedure has an enabled error handler, it is activated to handle the error. If the calling procedure's error handler is also active, control passes back through previous calling procedures until an enabled, but inactive, error handler is found. If no inactive, enabled error handler is found, the error is fatal at the point at which it actually occurred.
Each time the error handler passes control back to a calling procedure, that procedure becomes the current procedure. After an error is handled by an error handler in any procedure, execution resumes in the current procedure at the point designated by the Resume statement. .........
........................