Forum Discussion
tristaanogre
10 years agoEsteemed Contributor
Try this...
https://www.tutorialspoint.com/vbscript/vbscript_exit_for_statement.htm
I mean, you have it started... you just need to put the condition of your "IF" statement as the condition for your Exit For...
As for the error condition of if it's not found, that I think you need to handle outside of your loop... to do some sort of work to indicate that the loop didn't find what it was looking for. A trick is to create a variable before the loop, set it to false, then, when you find it, set it to true. So, it would be a combination of your if statement to set the variable and then adding the necessary Exit For