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

K

KelMon

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?
 
J

John Nurick

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, ...
 
E

Eric @ SEASH, Evansville

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.
 

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

Top