Import file in current folter

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

I'm using the TransferSpreadSheet function to importdata
from an excel spread. The *.xls file is in the same
folder as the database. I would like for the program to
look in this folder (current folder) for the file rather
than the default data folder. When I type in the filename
is there a way to indicate the current folder without
typing it in.

The name of the current folder will be different on
different computers.

Thanks...
 
You can use the CurrentProject.Path in the code to be the current path.

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"TableName",CurrentProject.Name & InputBox("Enter the filename.")
 
Back
Top