Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking for the existence of a worksheet Allen Excel Discussion (Misc queries) 1 January 20th 10 06:57 PM
Checking for the existence of a characted in a string Peter Rooney Excel Discussion (Misc queries) 2 June 21st 06 10:16 AM
Checking for existence of excel Dave Peterson[_3_] Excel Programming 3 June 26th 04 05:11 AM
Checking for existence of excel keepITcool Excel Programming 0 June 24th 04 06:07 PM
Checking for the Existence of a Folder Viswanath Tumu Excel Programming 2 April 19th 04 08:31 AM


All times are GMT +1. The time now is 12:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"