Or as the link orange provided shows, write lines to a text file. This would require building a query that has the data you want and open a recordset object, read each field of each record and construct the string to write out to text file.
To save report to Excel use OutputTo method. Here is very simple example:
Code:
Sub ExpRpt()
Dim xl As Excel.Application
Dim wb As Excel.Workbook
DoCmd.OpenReport "Compensation", acViewPreview
DoCmd.OutputTo acOutputReport, , acFormatXLS, "C:\Users\June\Forums\test2.xls"
DoCmd.Close
Set xl = CreateObject("Excel.Application")
Set wb = xl.Workbooks.Open("C:\Users\June\Forums\test2.xls")
wb.SaveAs "C:\Users\June\Forums\test2.csv", xlCSV
xl.Quit
Set wb = Nothing
Set xl = Nothing
End Sub
Similar code could also be used to export table or query objects instead of report. Can also use TransferSpreadsheet method. Review http://www.accessmvp.com/KDSnell/EXCEL_MainPage.htm