Resume Statement

KenHigg

Registered User
Local time
Today, 03:31
Joined
Jun 9, 2004
Messages
13,327
In the following cut and paste from VBA Help what does the '[0]' mean/do'?


Code:
Resume Statement
      

Resumes execution after an error-handling routine is finished.

Syntax

Resume [0]

Resume Next 

Resume line

The Resume statement syntax can have any of the following forms:

Statement Description 
Resume 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. 
Resume Next 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). 
Resume line Execution resumes at 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

If you use a Resume statement anywhere except in an error-handling routine, an error occurs.
 
In the following cut and paste from VBA Help what does the '[0]' mean/do'?


Code:
Resume Statement
 
 
Resumes execution after an error-handling routine is finished.
 
Syntax
 
Resume [0]
 
Resume Next 
 
Resume line
 
The Resume statement syntax can have any of the following forms:
 
Statement Description 
Resume 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. 
Resume Next 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). 
Resume line Execution resumes at 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
 
If you use a Resume statement anywhere except in an error-handling routine, an error occurs.

In versions of Basic other than Visual Basic, I have always interpreted "Resume 0" to mean "Resume at the Point of the failure". Of course, there had to be code to change the environment and eliminate the failure within the error trap. I assume that Visual Basic has similar rules.
 
the [0] optional isnt it, so presumably

resume and
resume 0 are the same

however, i didnt realise you could do that - but if you handle an error - try something in code, then go back - you may never escape, it seems to me.
 
Reading through the help I was thinking it may direct resume to continue from the routine that produced the error instead of were the error trap occured (or the other way around?) Say like when you call one pc of code from within a second routine...?
 

Users who are viewing this thread

Back
Top Bottom