validate a directory or file exits

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I validate if a file exists without using On Error Resume Next then
trying to open it?
 
if dir("C:\Myfolder\Myfile.xls") = "" then
msgbox "It doesn't exist"
exit sub
Else
workbooks.Open c:\Myfolder\Myfile.xls"
End if
 

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