description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: Resume Statement |
Resume Statement |
07/20/2015 |
|
|
e24d058b-1a5c-4274-acb9-7d295d3ea537 |
Resumes execution after an error-handling routine is finished.
We suggest that you use structured exception handling in your code whenever possible, rather than using unstructured exception handling and the On Error
and Resume
statements. For more information, see Try...Catch...Finally Statement.
Resume [ Next | line ]
Resume
Required. If the error occurred in the same procedure as the error handler, execution resumes with the statement that caused the error. If the error occurred in a called procedure, execution resumes at the statement that last called out of the procedure containing the error-handling routine.
Next
Optional. If the error occurred in the same procedure as the error handler, execution resumes with the statement immediately following the statement that caused the error. If the error occurred in a called procedure, execution resumes with the statement immediately following the statement that last called out of the procedure containing the error-handling routine (or On Error Resume Next
statement).
line
Optional. Execution resumes at the line specified in the required line
argument. The line
argument is a line label or line number and must be in the same procedure as the error handler.
Note
We recommend that you use structured exception handling in your code whenever possible, rather than using unstructured exception handling and the On Error
and Resume
statements. For more information, see Try...Catch...Finally Statement.
If you use a Resume
statement anywhere other than in an error-handling routine, an error occurs.
The Resume
statement cannot be used in any procedure that contains a Try...Catch...Finally
statement.
This example uses the Resume
statement to end error handling in a procedure and then resume execution with the statement that caused the error. Error number 55 is generated to illustrate use of the Resume
statement.
[!code-vbVbVbalrErrorHandling#16]
Namespace: Microsoft.VisualBasic
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)