ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   validate a directory or file exits (https://www.excelbanter.com/excel-programming/311271-validate-directory-file-exits.html)

Simon Shaw[_5_]

validate a directory or file exits
 
How do I validate if a file exists without using On Error Resume Next then
trying to open it?

Tom Ogilvy

validate a directory or file exits
 
if dir("C:\Myfolder\Myfile.xls") = "" then
msgbox "It doesn't exist"
exit sub
Else
workbooks.Open c:\Myfolder\Myfile.xls"
End if

--
Regards,
Tom Ogilvy


"Simon Shaw" wrote in message
...
How do I validate if a file exists without using On Error Resume Next then
trying to open it?





All times are GMT +1. The time now is 09:31 AM.

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