PC Review


Reply
Thread Tools Rate Thread

Determine if a File Exists

 
 
Connie
Guest
Posts: n/a
 
      8th Nov 2006
I am using the following code to open a file:

EmployeeListFileName = PathName + "\hourly employees.csv"
Set wb = Workbooks.Open(EmployeeListFileName)

The user is entered to enter the PathName. I would like to return a
message if the file is not found in the specified directory. How do I
test whether the file is found?

Any help would be appreciated. Thanks!

Connie

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      8th Nov 2006
EmployeeListFileName = PathName + "\hourly employees.csv"
On Error Resume Nexzt
Set wb = Workbooks.Open(EmployeeListFileName)
On Error Goto 0
If wb Is Nothing Then
Msgbox "File not found"
End If


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Connie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am using the following code to open a file:
>
> EmployeeListFileName = PathName + "\hourly employees.csv"
> Set wb = Workbooks.Open(EmployeeListFileName)
>
> The user is entered to enter the PathName. I would like to return a
> message if the file is not found in the specified directory. How do I
> test whether the file is found?
>
> Any help would be appreciated. Thanks!
>
> Connie
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I determine if a element exists in an xml file? cj Microsoft VB .NET 7 6th Aug 2007 01:18 PM
Determine if LDB file exists or if any users are in a DB =?Utf-8?B?WFA=?= Microsoft Access VBA Modules 2 15th Nov 2006 06:05 PM
Determine if a File Exists Connie Microsoft Excel Misc 1 8th Nov 2006 09:11 AM
Determine if a File exists Stephen E. Weber Microsoft VB .NET 7 13th Apr 2006 05:55 PM
Determine if File Exists Wayne Wengert Microsoft VB .NET 2 5th Jul 2005 10:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:50 PM.