paulnnosh
MIS
- Mar 25, 2004
- 32
Hello,
I am using this code to export data to an Excel spreadsheet. It was working fine when I hard coded a file name ("Prospects.xls") but falls over when I try to make the filename equal to the current time + Prospects.xls (e.g. 21:43:23Prospects.xls).
Can anyone tell me what I'm doing wrong?
Dim strReportName As String
strReportName = Time() & "Prospects.xls"
Debug.Print strReportName
DoCmd.OpenReport "Prospects", acPreview, , strFilter
DoCmd.OutputTo acOutputReport, "Prospects", acFormatXLS, strReportName, True
DoCmd.Close acReport, "Prospects"
I am using this code to export data to an Excel spreadsheet. It was working fine when I hard coded a file name ("Prospects.xls") but falls over when I try to make the filename equal to the current time + Prospects.xls (e.g. 21:43:23Prospects.xls).
Can anyone tell me what I'm doing wrong?
Dim strReportName As String
strReportName = Time() & "Prospects.xls"
Debug.Print strReportName
DoCmd.OpenReport "Prospects", acPreview, , strFilter
DoCmd.OutputTo acOutputReport, "Prospects", acFormatXLS, strReportName, True
DoCmd.Close acReport, "Prospects"