Report to save as Excel file (1 Viewer)

ashu.doc

Registered User.
Local time
Today, 00:09
Joined
Oct 8, 2012
Messages
24
Hi Everyone
I want to save my report as excel file on the user computer with a click of a button. I have tried this code:

Private Sub Cmd_ReporttoExcel_Click()
DoCmd.OutputTo acOutputReport, "Gastrolog Report", acFormatXLS, "C:\Users\XX\Documents" & Format(Date, "yyyymmdd") & ".xls"
End Sub

But it is giving error 2282 - The format in which you are attempting to output the current object is not available.

The other part of this question is ::banghead::banghead:
This is something similar when I didn't have "PDF add in " in access 2007, when I added PDF add in then option to save file in PDF was available in "output to" action of macro. There is nothing like \excel add in. However when I can export the data in excel sheet by Export function in access why don't I have option to save file as excel in "output to " action in macro? I want to have this option so that user can click a button in the form rather than in the top ribbon try to find out how to transfer and save the excel sheet.

many thanks
Ash
 

vbaInet

AWF VIP
Local time
Today, 08:09
Joined
Jan 22, 2010
Messages
26,374
GinaWhipp could be right but since you mentioned that you can export to Excel via the ribbon have you also tried DoCmd.TransferSpreadsheet ?
 

ashu.doc

Registered User.
Local time
Today, 00:09
Joined
Oct 8, 2012
Messages
24
Hi Everyone
I have sorted this out in a different way, as we know access 2007 SP1 does not support saving report as excel, but it does support saving table data as excel!! So I just had to change that in Macro and works perfect.
Thanks all
 

Users who are viewing this thread

Top Bottom