Results 1 to 4 of 4

Thread: Run Time Error?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2004
    Posts
    23

    Run Time Error?

    how to avoid crashing the program and resuming back when i get message RunTimError File not Found ?

    When i get this error i want it to display: Msgbox"File Not Found",vbinformation

    is it possibile!?

  2. #2
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951
    In your code you could start with :

    On Error go to errorcode

    then at the bottom put an

    Exit Sub

    followed by

    errorcode:
    MsgBox "An error occurred: [" & Err.Number & "] " & Err.Description & " - Source: " & Err.Source

  3. #3
    VB Code:
    1. Public Function pFunction() As Boolean
    2.      On Error GoTo Err:
    3.    
    4. 1   Let pFunction = True
    5. 2   Exit Function
    6. Err:
    7.     Call Err.Raise(Err.Number, Err.Source, Err.Description & vbNewLine & "pFunction:" & Erl, Err.HelpFile, Err.HelpContext)
    8. End Function

    be sure to number the lines

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Run Time Error?

    Originally posted by theCro
    how to avoid crashing the program and resuming back when i get message RunTimError File not Found ?

    When i get this error i want it to display: Msgbox"File Not Found",vbinformation

    is it possibile!?
    You may simply check if file exist right before you open it:
    VB Code:
    1. If Not Dir("full_file_path_plus_name", vbNormal) = "" Then
    2.     'open file here
    3. End If

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