Below is a very basic way to check for error’s when creating basic Vb-script’s. Just add this procedure to your script and call it after your main code has been executed. This is useful if you run and test a lot of scripts from the command prompt on a Windows machine. I wouldn’t recommend this as a long term production solution but it’s quick and gets the job done for trouble shooting!

Sub checkErrors()
 If (Err.Number >< 0) Then
  WScript.Echo "****** BEGIN ERROR INFO ******"
  WScript.Echo " Number: " & Err.Number
  WScript.Echo " Description: " & Err.Description
  WScript.Echo " Source: " & Err.Source
  WScript.Echo "****** END ERROR INFO ******"
 Else
  WScript.Echo "****** NO ERRORS OCCURED! ******"
 End If
End Sub
0 Comments