Check for file existance

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
That just comes up with help for "Dir Property (Data Access Page)".

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


Ron.
 
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 ...
 
Try

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