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!?
Printable View
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!?
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
VB Code:
Public Function pFunction() As Boolean On Error GoTo Err: 1 Let pFunction = True 2 Exit Function Err: Call Err.Raise(Err.Number, Err.Source, Err.Description & vbNewLine & "pFunction:" & Erl, Err.HelpFile, Err.HelpContext) End Function
be sure to number the lines
You may simply check if file exist right before you open it:Quote:
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!?
VB Code:
If Not Dir("full_file_path_plus_name", vbNormal) = "" Then 'open file here End If