File Not found

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

Worksheets(4).Range("A6").Value contains a file path.

What is the code to look for a file in that
location "Worksheets(4).Range("A6").Value" and if the file
is NOT FOUND, then msgbox "File Not Found" else continue
with code?


Todd Huttenstine
 
Sub testit()
Dim strTemp As String

strTemp = Worksheets(1).Range("A6").Value

If strTemp <> "" Then
If Dir(strTemp) = "" Then
MsgBox "File Not Found"
Exit Sub
End If
End If
End Sub
 
Thank you


Todd
-----Original Message-----
Sub testit()
Dim strTemp As String

strTemp = Worksheets(1).Range("A6").Value

If strTemp <> "" Then
If Dir(strTemp) = "" Then
MsgBox "File Not Found"
Exit Sub
End If
End If
End Sub




.
 
Back
Top