ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vba - Checking existence of file (https://www.excelbanter.com/excel-programming/306679-vba-checking-existence-file.html)

ajliaks[_26_]

Vba - Checking existence of file
 
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

--
Message posted from http://www.ExcelForum.com


Chip Pearson

Vba - Checking existence of file
 
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



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

indicated
folder?

something like...

object.exists filename=Path & FileName

Thanks in advance.
Aldo.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:19 PM.

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