Best way to export query results to excel (1 Viewer)

MattioMatt

Registered User.
Local time
Today, 17:04
Joined
Apr 25, 2017
Messages
99
What's the best method for exporting query results to excel?

Through a search on the forums, it seems it can be done via VBA or via a Macro.

I'd prefer the option to be able to export without having the save the file, so that the end user gets the choice to save the file or not. There is a post on this forum with someone else asking but the code in there no longer seems to be working.

Has anyone got an input into this, any best practices and whether you can export without saving the file first?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 09:04
Joined
Aug 30, 2003
Messages
36,124
You mean export it to Excel without saving the Excel file? The only way that comes to mind is Excel automation. TransferSpreadsheet and OutputTo will both create a file. Search on copyfromrecordset which should turn up the code for automation.
 

Ranman256

Well-known member
Local time
Today, 12:04
Joined
Apr 9, 2015
Messages
4,339
vFile="c:\folder\myfile.xls"

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qsDataQuery", vFile, True,tabname
 

Users who are viewing this thread

Top Bottom