Command button event to export access query to excel and attach to email
Posted on 2013-02-04
I have form in access. I have a button on the form on click I export the result of a query in access to excel. I like to know if instead of saving it, if I can directly attach the excel as an attachment to a email to be send via outlook.
Code to export to excel
the on click event
Dim stDocName As String
Dim stLinkCriteria As String
'Export report to MS Excel
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "OrderviewQry", "C:\Temp\OrderReport.xls"
MsgBox "The Selected Orders will be exported to Excel and saved in"