Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does File Exist


Im after a small piece of code that will check a directory for a certai
file and advise whether it exiss or not.

Thank you in advance for anyhelp you can provide

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=39949

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does File Exist


Code
-------------------
if Not Dir("C:\DATA\YOURFILE.XLS") then
'the bugger isnot there!
end i
-------------------


Dir returns an empty string if no file is found matching the 'search
pattern

--
Dnere
-----------------------------------------------------------------------
Dnereb's Profile: http://www.excelforum.com/member.php...fo&userid=2618
View this thread: http://www.excelforum.com/showthread.php?threadid=39949

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Does File Exist


Good afternoon ceemo

The example below will check whether your C:\ drive contains a fil
called filename.xls. In the unlikely event that it does, "TRUE" wil
be returned in a msgbox, otherwise (and probably) "FALSE" will b
returned.

Sub DoesFileExist()
Set MyFile = CreateObject("Scripting.FileSystemObject")
MsgBox MyFile.FileExists("c:\filename.xls")
End Sub

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=39949

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
does a file exist Arien Excel Discussion (Misc queries) 3 January 3rd 06 01:27 PM
File does not exist Judd Jones[_2_] Excel Programming 2 January 14th 05 03:18 PM
Does file exist? ianripping[_81_] Excel Programming 4 July 26th 04 12:48 PM
Detecting If An .xls File Exist abxy[_60_] Excel Programming 2 May 7th 04 08:00 PM
does a file exist? Keith Willshaw Excel Programming 0 September 10th 03 04:42 PM


All times are GMT +1. The time now is 10:12 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"