Vba - Checking existence of file

  • Thread starter Thread starter ajliaks
  • Start date Start date
A

ajliaks

Hi all,

First of all, I 'd like to thanks you all for your kindly assistence.

Now, I have this situation:

Before running macro, I need to check the existence of specific file.

I have the path and file name.
Is there any way to check the existence of the file in the indicate
folder?

something like...

object.exists filename=Path & FileName

Thanks in advance.
Aldo
 
Aldo,

Use the Dir function. If it returns an empty string, the file
does not exist. E.g.,

If Dir(Filename) = "" Then
' file does not exist
Else
' file exists
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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