在错误处理例程完成之后继续程序执行。
Resume [ Next | line ]
各部分说明
- Resume 
 必选。 如果错误发生在错误处理程序所在的同一过程中,程序将由产生错误的语句处继续执行。 如果错误发生在被调用的过程中,程序将从最近过程(该过程含有错误处理例程)调用的语句处继续执行。
- Next 
 可选。 如果错误发生在错误处理程序所在的同一过程中,程序由紧随引发错误的语句的下一条语句处继续执行。 如果错误发生在被调用的过程中,程序由紧随最近过程(该过程含有错误处理例程)调用的语句的下一条语句继续执行(或者 On Error Resume Next 语句)。
- line 
 可选。 程序从必选参数 line 指定的代码行处继续执行。 line 参数是一个行标签或者行号,必须位于错误处理程序所在的同一过程中。
备注
如果在错误处理例程以外的任何位置使用 Resume 语句,将会发生错误。
Resume 语句不能用于包含 Try...Catch...Finally 语句的任何过程中。
示例
此示例使用 Resume 语句来结束过程中的错误处理,然后继续执行导致错误的语句。 将生成错误号 55 以表明使用的是 Resume 语句。
Sub ResumeStatementDemo()
  On Error GoTo ErrorHandler   ' Enable error-handling routine.
  Dim x As Integer = 32
  Dim y As Integer = 0
  Dim z As Integer
  z = x / y   ' Creates a divide by zero error
  Exit Sub   ' Exit Sub to avoid error handler.
ErrorHandler:     ' Error-handling routine.
  Select Case Err.Number   ' Evaluate error number.
      Case 6   ' "Divide by zero" error.
        y = 1 ' Sets the value of y to 1 and tries the calculation again.
      Case Else
        ' Handle other situations here....
  End Select
  Resume   ' Resume execution at same line
  ' that caused the error.
End Sub
要求
**程序集:**Visual Basic 运行库(位于 Microsoft.VisualBasic.dll 中)