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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top