Vbscript.. On error Goto

Posted on 2007-08-08
Last Modified: 2010-05-28
Hi. Good Day to all. I have this problem. How can i do this in vbscript? I know this works in vb 6.

On Error Goto ErrHandler
 statement1 ' this is the line having an error

  statements if error has occured

Question by:amcurso
    LVL 142

    Assisted Solution

    by:Guy Hengel [angelIII / a3]
    in vbscript, you only have the on error resume next.
    and after each critical statement, check err.number
    LVL 58

    Accepted Solution

    VBScript doesn't have this kind of error handler mechanism. It has only

    On Error Resume Next
    On Error GoTo 0

    i.e. to tolerate the error. You need to then test error after every possible statement using

    If Err.Number <> 0 then

    Author Comment

    Thanks. i just realized that. sigh... :-(

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
    This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now