Check if Excelsheet is present

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

Guest

Does anybody knows a piece of code, wich I can use to check if my import.xls
Excelsheet is present, in a particular fodler?

I use this import.xls to import data into the database.

Thanks!
 
Try

If Dir("Path to file\Filename") = "" Then
'File doesn't exist
Else
'File does exist
End If
 
Hi, Jochem.
Does anybody knows a piece of code, wich I can use to check if my import.xls
Excelsheet is present, in a particular fodler?

Try:

strPathAndFileName = "C:\Test\import.xls"

If (Len(Dir(strPathAndFileName)) > 0) Then
' It exists.
' Code goes here.
Else
' Other code goes here.
End If

.. . . where C:\Test is the name of the directory, and import.xls is the name
of the file in that directory.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
 
Back
Top