View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Determine if a File Exists

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" wrote in message
ups.com...
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