File Not found

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
 
R

Rob van Gelder

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
 
T

Todd Huttenstine

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




.
 
Top