How to use today's date for part of the file name when importing

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

Guest

I wrote a macro to import date from excell. I want to use today's date as
part of the file name. Is there a condition that allows me to do this in the
macro?
 
I don't know whether this is possible with a macro, but it's easy in
VBA:

Dim strFileName As String

strFileName = "File" & Format(Date(),"yyyy-mm-dd") & ".xls"
DoCmd.TransferSpreadsheet acImport, strFileName, ...
 
I just used:

="F:\Charge Details\charges_" & Format(Date(),"mm-dd-yy") & ".xls"

as the "File Name" value in a TransferSpreadsheet command in a macro and the
end result was the creation of a file in the F:\Chargte Details folder called
charges_05-19-05.xls

In other words, you CAN do that in a macro.
 
Back
Top