View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default 2007 Compatability

Use Dir Jeff

If Dir("C:\test.xls") < "" Then


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Jeff" wrote in message ...
Hi,

I have a function written in Excel 2003:

Sub Check_if_files_exist(path, fname, fileexists2)

With Application.FileSearch
.NewSearch
.FileName = fname
.LookIn = path
.Execute

If .FoundFiles.Count = 1 Then
fileexists2 = 1 'The File exists
Else
fileexists2 = 0 'The file does not exist
End If

End With

End Sub

The problem is that someone with 2007 cant use this because it does not
recognize
With Application.FileSearch. Is there another command that is compatable in
both 2003 and 2007?

Thanks