Question : Export Report to Excel from Access

I have a report in Access that I want to export to Excel using VB code

This is telling me that the object/repor tis not found.

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
     Rpt_Names, strFileName, True

Answer : Export Report to Excel from Access

export the recordsource of the report not the report

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
     "QueryNameOrTableName", strFileName, True

change "QueryNameOrTableName" with the record source of the report

just minding to not expect the formatting of your report to be forwarded to the excel file

Random Solutions  
 
programming4us programming4us