Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OutputToExcel

Status
Not open for further replies.

Troopa

Technical User
Nov 9, 2001
96
GB
Hi all,

I've created a macro that does the following

OpenQuery
RunCommand
Close

So it runs the specified query, then on the RunCommand I have the command set to 'OututToExcel'

All this works as I'd like but I was wondering if there's an easy way to save the file with a date stamp?

Currently the file is saved as the name of the query that's run in the default database address.

Thanks
 
In a new module, add a function using this as an example:
Code:
Function Xferxls_LateChgs_Daily()

Dim strFileName As String
strFileName = "c:\Charge_Posting_Daily_" & Format(Date - 1, "mm-dd-yy") & ".xls"
DoCmd.TransferSpreadsheet acExport, 8, "qryLateChgsDaily_xtab", strFileName
End Function
This example appends yesterday's date to the file name.

In your macro use the RunCode action and specify your function name there....

Si hoc legere scis, nimis eruditionis habes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top