Results 1 to 3 of 3

Thread: Very Simple Error Handling Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    178

    Question

    This is probably an easy question but I was wondering whether this code would pick up both errors

    Code:
    Private sub Mysub()
    
    Components_Filepath = Workbooks(Master_Workbook).Sheets("constants").Range("E5").Value
    
    On Error GoTo Master_NotFound
    
    Astr = Application.Workbooks(Master_Workbook).Path & "\[" & _
           Application.Workbooks(Master_Workbook).Name & "]"
    
    On Error GoTo No_Components
    
    Workbooks.Open FileName:=Components_Filepath, _
            UpdateLinks:=0, Editable:=True
    'more code goes here
    exit sub
    
    
    
    No_Components:
    
    'do something here
    
    Resume
    
    Master_NotFound:
    
    'do something here
    
    Resume
    
    End sub
    So I suppose my question is can you put more than one On Error GoTo statement within one procedure


    Cheers for any help
    Steve

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    Yes you can. And yes that should work.
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    178

    Thumbs up Thanks

    Thanks Buzby

    Steve

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