|
Question : How to carry out the Office Links, Analyze it with Excel
|
|
Hello - In the OnClose event of a report, I would like to send the rpt's RecordSource query to Excel. Not using TransferSpreadsheet; I don't want to have to supply the FileName argument (the user can do that from Excel if they want to save it).
I just want to get to the same place as if I had selected this query in the database window, and selected Tools / Office Links / Analyze it with Excel from the menu bar.
I've tried: DoCmd.SelectObject acQuery, "MyQuery", True DoCmd.RunCommand acCmdOutputToExcel
, but this shows the database window,and I don't want that...
Thanks
Mark
|
|
Answer : How to carry out the Office Links, Analyze it with Excel
|
|
Quite a thorough answer from MNelson831
mlagrange the simple way, but it does leave the query open is to take what u got and tweak it
DoCmd.SelectObject "MyQuery", , acReadOnly DoCmd.RunCommand acCmdOutputToExcel
If u take MNelson831's suggestion, I would stop after performing CopyFromRecordset U can add the formatting if u want, but dont close xl and ignore the save since u said u just want excel open
|
|
|
|