Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default validate a directory or file exits

How do I validate if a file exists without using On Error Resume Next then
trying to open it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default validate a directory or file exits

if dir("C:\Myfolder\Myfile.xls") = "" then
msgbox "It doesn't exist"
exit sub
Else
workbooks.Open c:\Myfolder\Myfile.xls"
End if

--
Regards,
Tom Ogilvy


"Simon Shaw" wrote in message
...
How do I validate if a file exists without using On Error Resume Next then
trying to open it?



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
How can I validate my Excel password against a INI file Andrea Excel Worksheet Functions 1 June 30th 09 09:10 PM
file save error: the file or directory cannot be created dublg Excel Discussion (Misc queries) 1 September 25th 06 07:07 PM
Excel should let me sort the file directory when saving a file Beanee70 Excel Discussion (Misc queries) 0 March 14th 06 07:03 AM
Excel Exits on File Close with Outlook Erin Searfoss Excel Discussion (Misc queries) 1 January 16th 05 09:43 PM
get path - save new file - same sub-directory as existing file tegger Excel Programming 2 October 21st 03 10:45 AM


All times are GMT +1. The time now is 04:36 AM.

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"