Here is some sample code that I use to export Access reports/queries to Excel. You can modify as needed, but it will show you how I add the date to the file name. This adds the current date to the file name.
Code:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim reportName As String
Dim theFilePath As String
Select Case Me.Frame6.Value
Case 1
reportName = "MonthlyActivity"
End Select
theFilePath = Me.txtfilepath.Value
theFilePath = theFilePath & reportName & "_" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, reportName, theFilePath, True
MsgBox "Look on your desktop for the report."
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim stDocName As String
stDocName = "Rejects By Analyst"
DoCmd.OpenReport stDocName, acNormal
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
Alan