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

I am trying to have excel file check to see if another excel files is a
directory. If it is i want it to call it and run that file. But if that
file is not i want it to continue on. Any help on how to do this would be
great.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Check a file in a directory

Path = "driverletterhe\directoryhere\filenamehere"
If Len(Dir(Path)) = 0 Then


"Rich Cooper" wrote in message
...
I am trying to have excel file check to see if another excel files is a
directory. If it is i want it to call it and run that file. But if that
file is not i want it to continue on. Any help on how to do this would be
great.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Check a file in a directory

Rich,

Try something like

Dim FName As String
Dim WB As Workbook
FName = "C:\Test\Test.xls" '<<<< CHANGE FILE NAME
If Dir(FName)<"" Then
' file exists
Set WB = Workbook.Open(FName)
Else
' file does not exist
End If

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Rich Cooper" wrote in message
...
I am trying to have excel file check to see if another excel

files is a
directory. If it is i want it to call it and run that file.

But if that
file is not i want it to continue on. Any help on how to do

this would be
great.




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
Check if a directory exists and if it doesn t... Grek[_5_] Excel Programming 5 May 8th 04 09:12 PM
How to check if a folder/directory exist using VBA wellie Excel Programming 1 March 1st 04 02:24 AM
How to check if the directory exists? ira Excel Programming 2 January 19th 04 01:22 PM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 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 03:36 AM.

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

About Us

"It's about Microsoft Excel"