Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 3.15 KB

resume-statement.md

File metadata and controls

68 lines (48 loc) · 3.15 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Resume Statement
Resume Statement
07/20/2015
vb.Resume
vb.ResumeNext
Next statement [Visual Basic], Resume
Resume Next statement [Visual Basic]
execution [Visual Basic], resuming
run-time errors [Visual Basic], resuming after
Resume statement [Visual Basic], syntax
errors [Visual Basic], resuming after
Error statement [Visual Basic], and Resume statement
execution
Resume statement [Visual Basic]
e24d058b-1a5c-4274-acb9-7d295d3ea537

Resume Statement

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.

Syntax

Resume [ Next | line ]  

Parts

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.

Remarks

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.

Example

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]

Requirements

Namespace: Microsoft.VisualBasic

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See also