Connecting Tech Pros Worldwide Forums | Help | Site Map

Exporting a Report to Excel

Frederico Ottoni
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi there,

Please, how can I export a report from access to excel? Is there a
command to do this?
A sample would be very appreciated.

Thanks in advance.
Ottoni.

*** Sent via Developersdex http://www.developersdex.com ***

pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Exporting a Report to Excel


right-click on the report, choose Export, Choose Excel as the
destination file type.

Frederico Ottoni
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Exporting a Report to Excel


Sorry, I want to do this through a VBA macro.
Can anyone help?

Thanks.
Ottoni.



*** Sent via Developersdex http://www.developersdex.com ***
pietlinden@hotmail.com
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Exporting a Report to Excel


Some interesting reading...

http://support.microsoft.com/default...b;en-us;208838

For a single report:

Function basSendReportToExcel()
On Error GoTo basSendReportToExcel_Err

' Output a single report to Excel
DoCmd.OutputTo acReport, "Pledge Listing",
"MicrosoftExcelBiff8(*.xls)", "C:\Documents and
Settings\user\Desktop\xlsReport.xls", False, "", 0


basSendReportToExcel_Exit:
Exit Function

basSendReportToExcel_Err:
MsgBox Error$
Resume basSendReportToExcel_Exit

End Function

Yes, I read that you wanted to do this in a macro. Except you can't
cut & paste steps from a macro to anywhere. Otherwise, if you have to
use macros, check out the OutputTo command.

If you're outputting a lot of reports to the same SS, you might want to
check out something like this:

Public Sub EnumerateReports()
Dim aobj As AccessObject
For Each aobj In CurrentProject.AllReports
'--process the report here - export or whatever.
DoCmd.OutputTo acReport, aobj.Name,
"MicrosoftExcelBiff8(*.xls)", "C:\Documents and
Settings\user\Desktop\xlsReport.xls", False, "", 0

Next aobj

End Sub

Closed Thread