File Exists

M

Mike McLellan

Is there an easy way of telling whether or not a file exists? What I am
looking for is something along the lines of =IF
(FILE_EXISTS(C:\FILENAME),"OK","not OK")
 
B

Bob Phillips

Best to add a UDF

Function BookExists(wb As String)
BookExists = Len(Dir(wb)) > 0
End Function


and use like


=IF(BookExists("C:\myfile.xls"), "yes","no")


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 
M

Mike McLellan

Many thanks, Bob

Bob Phillips said:
Best to add a UDF

Function BookExists(wb As String)
BookExists = Len(Dir(wb)) > 0
End Function


and use like


=IF(BookExists("C:\myfile.xls"), "yes","no")


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 
Top