ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Not found (https://www.excelbanter.com/excel-programming/286284-file-not-found.html)

Todd Huttenstine[_2_]

File Not found
 
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

Rob van Gelder[_4_]

File Not found
 
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

"Todd Huttenstine" wrote in message
...
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




Todd Huttenstine[_2_]

File Not found
 
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

"Todd Huttenstine"

wrote in message
...
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



.



All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com