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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputto Excel File Name Problem 1

Status
Not open for further replies.

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"
 
try using format(now(),"hh.nn.ss") instead of Time(). colons are not allowed in filenames.
HTH
Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top