Check for file existance

R

Ron

Hi,

Is it possible for me to check for the existence of a particular excel file
before trying to save one with the same name?

I am trying to use access to automate some spreadsheets.


Regards,
Ron.
 
R

Ron

That just comes up with help for "Dir Property (Data Access Page)".

I'm using Access 2000, maybe the help is different.


Ron.
 
A

Allen Browne

You need to do this in the code window, not the Access window. They provide
different help.

In any case, it's as simple as:
If Dir("C:\MyFolder\MyFile.xls") <> "" Then ...
 
O

Ofer

Try

Dim strPath As String
strPath = "c:\FileName.xls"
If Dir(strPath) = "" Then
MsgBox "Can't find file"
Else
....
End If
 
Top