In addition to DMasons answer, microsoft broke down the removal of "On Error Goto X" command and it's purpose. Unfortunately, unlike many languages (javascript, C#) that have the extremely handy and convenient "Try{} and Catch{}" parameters, vbscript does not offer an extensive break down of handling errors. Yes the On error resume next command is efficient at it's simplistic purpose, but there are other methods for handling errors which i've found useful.
For instance, you can create troubleshooting code easier with this code:
Troubleshootvbs.vbs
Const Troubleshoot_this_code = "C:\testenv\testfail.vbs"
Const Place_Results_In = "C:\testenv\troubleshoot.log"
Dim filesystemobject: Set filesystemobject = CreateObject("Scripting.FileSystemObject")
Dim filetotroubleshoot: Set filetotroubleshoot = filesystemobject.OpenTextFile(Troubleshoot_this_code, 1, True)
Dim Troubleshoot_Lines : Troubleshoot_Lines = split(filetotroubleshoot.ReadAll, vbcrlf)
Dim tbl : Set tbl = filesystemobject.OpenTextFile(Place_Results_In, 8, True)
Dim InsertErrorHandling(),IEH,line : Redim InsertErrorHandling(1) : IEH = 1
InsertErrorHandling(0) = "On Error Resume Next"
For each line in Troubleshoot_Lines
dim errclause : errclause = "if err.number<>0 then : return=" & chr(34) & "Error Found on Line[" & chr(34) & " & IEH & " & chr(34) & "]:" & chr(34) & " & err.number & " & chr(34) & ":" & chr(34) & " & err.description & vbcrlf : err.clear : else : return = IEH & " & chr(34) & ": Clear" & chr(34) & " & vbcrlf : end if : tbl.Writeline return : IEH = IEH + 1"
InsertErrorHandling(ubound(inserterrorhandling)) = line & vbcrlf & errclause
Redim Preserve InsertErrorHandling(Ubound(InsertErrorHandling)+1)
Next
dim FullTestCode : FullTestCode = Join(InsertErrorHandling, vbcrlf)
ExecuteGlobal FullTestCode
tbl.close
Sample: TestFail.vbs
dim query : query = CreateObject("Scripting.FileSystemObect")
dim result : result = query.CreateTextFile("test.txt")
dim fail : fail = result.readall
Sample: Troubleshoot.log
Error Found on Line[1]:429:ActiveX component can't create object
Error Found on Line[2]:424:Object required
Error Found on Line[3]:424:Object required
On Error GoToin VBScript. Instead, useOn Error Resume Nextand then check bothErr.Numberand theCountproperty of the Errors collection. Prob not the answer you were looking for. :( msdn.microsoft.com/en-us/library/windows/desktop/… - Dave Mason