Adding date to exported spreadsheet name

Wayne Cramer

Registered User.
Local time
Today, 17:47
Joined
Aug 10, 2007
Messages
93
I have a macro that transfers spreadsheets to sixteen folders. Each has a distinct name and directory. The problem is that this is done daily and the spreadsheet will overwrite the previous days entry. Is there a way to automatically insert the current days date into the file names?
For example a file name is currently WI W3 Daily Report.xls. I would like it to be W1 W1 Daily Report 8-31-07.xls. Any help will be greatly appreciated.
 
use format function on the date

i.e

strFileName = "W1 Daily Report " & Format(YourDate,"dd-mm-yy")
 
use format function on the date

i.e

strFileName = "W1 Daily Report " & Format(YourDate,"dd-mm-yy")

Or even strFileName = "W1 Daily Report " & Format(YourDate,"mm-dd-yy") if you want US style dates
 
If you are using code:
Code:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Qry-TP Task-Daily Report", "C:\reports\" & "TP Cor " & Format(Now(), "mm-dd-yy") & ".xls"
 

Users who are viewing this thread

Back
Top Bottom