Results 1 to 3 of 3

Thread: Error Handling.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    I am having a little bit of trouble with error handling my error handling looks something like this.

    On Error GoTo Error1

    ' My Code here

    Exit Sub

    Error1:
    On Error GoTo Error2:

    'More code here

    Exit Sub

    Error2:
    'Third lot of Code here

    my programs is extracting some data out of a webpage, but it performs a run time error 5 for some pages so I use 3 different ways of extracting the data if it performs an error on the firt way it goes to the second way, if it performs an error in the second way it is supposed to go to the third way of getting data (in error2) but it goes to the second method, but if it gets an error in the second way it just gives the error and closes, instead of going to the third method. how would I fix this?

    thanx for your time.

  2. #2
    Guest
    You can use the err function to see your error number,
    and catch it. so you can do something with it.

    Code:
    On Error Goto Err_
    
    
    Err_:
    
    Select Case Err.Number
      Case 5
        Call MsgBox(Err.Number & Chr(13) & _
          Err.Discription, VbOkOnly, "Error")
    
    End Select

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2000
    Posts
    215
    Hi kayoca, no I don't want the error number I know what error it is, what I want it to do is when the error happens to skip to the data extracter for it to try to see if it can successfully complete what it is doing and if that can't and performs an error there then skip to third and final method that sort of thing. But after it has skipped to the next data extracter the first time it works, but if that data extracter performs an error instead of skipping to the next and final data extractor it performs the error and quits.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width