Import Excel File with Specific Date

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

Guest

Can anyone help me with this problem? Users regularly import a file from
Excel. In Excel each new copy of the file is saved with the date, eg MyFile
120507. The next day it will be saved as MyFile 130507 (UK format). I can
automate this using either a macro or a module for a file which always has
the same name, however my knowledge does not extend to the date changing.
Can anyone tell me how to write a variable into the macro that will allow the
user to change the date each time?

Your help, as always, would be highly appreciated.

Many thanks
Aehan
 
Dim strFile As String

strFile = "E:\Folder\MyFile " & Format(Date(), "ddmmyy") & ".xls"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "MyTable",
strFile
 
Hi Douglas

Thank you so much for helping me with this. Your solution works a treat.

Aehan
 
Back
Top