Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skip Iteration of For Loop

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Guys,

I have a for loop and the first thing I do in each iteration of the loop is create an output file. I want to test if an error has been generated (easy) and if it has generate an error message (easy) and then skip to the next iteration of the loop.

There is a cotinue keyword in JScript that will allow you to do this. How can I do it in VBScript?? Mighty :)
 
Can you use another 'Next' to do this?
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
No, you can't do that. You just get an "Unexpected Next" error. Mighty :)
 
can you perform an If Else within the For statement or a Do While etc to wrap all your code within it

For Each element in fred
If fso.FileExists Then
proceed = Nothing
Else
perform the code here....
End If
Next

Can you post your code to give us a better feel of what you are trying to achieve?


Regards
Steve Friday
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top