If the calling procedure has an enabled error handler, it is activated to handle the error. Control returns to the calling procedure. 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. 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.Īn "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. Use this form rather than On Error GoTo when accessing objects.ĭisables any enabled error handler in the current procedure. Specifies that when a run-time error occurs, control goes to the statement immediately following the statement where the error occurred and execution continues. The specified line must be in the same procedure as the On Error statement otherwise, a compile-time error occurs. If a run-time error occurs, control branches to line, making the error handler active. The line argument is any line label or line number. The On Error statement syntax can have any of the following forms: StatementĮnables the error-handling routine that starts at line specified in the required line argument. On Error GoTo line On Error Resume Next On Error GoTo 0 Enables an error-handling routine and specifies the location of the routine within a procedure can also be used to disable an error-handling routine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |