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!

ignore error function??

Status
Not open for further replies.
Mar 28, 2002
4
US
Is there any function in vbscript that will allow me to tell the script to continue when an error is generated?

The problem I'm having is that I'm writing a script that automatically populates information into Active Directory, but if any information is left out, it generates an error and stops the script. There will be situations where I'll need to the script to keep running, but I'm sure that some information will be left out. Any suggestions?
 
It sounds like you may want to put

On Error Resume Next

at the beginning of your program. That will force it to discard the error and go to the next line.
 
This is copied from the VBScript help you can get online from Microsoft:

If you don't use an On Error Resume Next statement, any run-time error that occurs is fatal; that is, an error message is displayed and execution stops.

On Error Resume Next causes execution to continue with the statement immediately following the statement that caused the run-time error, or with the statement immediately following the most recent call out of the procedure containing the On Error Resume Next statement. This allows execution to continue despite a run-time error. You can then build the error-handling routine inline within the procedure. An On Error Resume Next statement becomes inactive when another procedure is called, so you should execute an On Error Resume Next statement in each called routine if you want inline error handling within that routine.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top