Hi,
I've been trying to export a query using the event builder with the exportwithformatting function. I am trying to include todays date in file name when the macro is run.
So far I have looked at a few forums and has tried these two file names but neither has worked.
"c:\Access Data\Expenses" & Date() & ".xlsx"
"c:\Access Data\Expenses" & (Format(Date(),"yymmdd") & ".xlsx"
This is to go in the Output File field.
I did find a piece of code that worked but it didn't include any formatting.
Dim mnth As String
Dim dy As String
Dim yr As String
Dim file_nme As String
mnth = Month(Now())
dy = Day(Now())
yr = Year(Now())
file_nme = "c:/" + mnth + "-" + dy + "-" + yr + ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Your Table Name", [file_nme]
Can anyone help me find a solution to this?
Thank you