Vba - Checking existence of file

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
 
C

Chip Pearson

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
 
Top