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




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top