Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
does a file exist | Excel Discussion (Misc queries) | |||
File does not exist | Excel Programming | |||
Does file exist? | Excel Programming | |||
Detecting If An .xls File Exist | Excel Programming | |||
does a file exist? | Excel Programming |