To Here: https://excelfox.com/forum/showthrea...ll=1#post10545
Error and Error Handling VBA Summary
Error Handling Code line ORNeRe_GoRoT_N0Nula_1_____
|
Notes
|
On Error Resume Next
|
Makes code always carry on after error line. Clears the exception – So it works time and time again, But retains infomation of last error in Err object The further runing of code is normal code running as that running previous to the error, with the error handling enabled but not active. ( Effectively the error handler is only very briefely active at the error occurance time)
|
On Error GoTo Label/Line
|
Does not clear the exception. Just goes to the indicated Label or Line Number (Typically at that label or line number would be code lines for an error handling routine ) It is Prevented by default ( due to it not clearing the exception ) from working more than once The futher running code is effectively part of the Exception running software. The error handler is therefore active continuously aftert the error occurance.
Note this does the disable and Clear in either the normal or exception state
|
On Error GoTo 0
|
Does not clear the exception !! Disables any enabled error handler This Clears the Err object
|
On Error GoTo -1
|
Clears the exception , (* in other words, Deactivates any enabled error handler) Does not disable any enabled error handler This Clears the Err object
|
Resume
|
Clears the exception, (in othert words * Deactivates any enabled error handler) Does not disable any enabled error handler. Makes code try again at error line. ( Be careful as can lead to an infinite loop of retrying!) Does not retain infomation of last error: Clears Err object Typical usage would be as the last code line in an error handling code section sent to with On Error GoTo Label/Line
|
Resume Next
|
As Resume , but resumes after line which errored
|
Resume Label/Line Number
|
As Resume , but resumes at Label/Line number
|
* Deactivated means: "The trap is reset: but not currently working - It is "primed" ". It is enabled, but not activated. !! Disabled means its "no longer there", so you are back to default VBA error handler
Err : An object. (Possibly a not too well thought out VBA type pseudo object, being strangely read or write). 6 Properties containing strings of information about last error & 2 Methods, .Raise and .Clear .Clear simply empties the string infomation Properties of Err
Erl : A Function or Method effectively returning line number of last error or 0 if no line number is present at erroring code line. It is possible this is just an old thing only working in the exception state to give the last excecuted line in the normal state.
vbObjectError : Probably broken or no one remembers what it does - A plie of wank - forget about it!
Bookmarks