Forum Discussion
karenlorr_uk
Apr 05, 2021Copper Contributor
Export access query to formatted Excel spreadsheet - VBA.
I have a query (qry_myexport) and if I right click it in the navigation pane the option to export it (formatted) to excel is shown. How can I code a button to do this in VBA? I have search...
isladogs
Apr 06, 2021MVP
Have you looked into the DoCmd.TransferSpreadsheet code?
See https://docs.microsoft.com/en-us/office/vba/api/access.docmd.transferspreadsheet
See https://docs.microsoft.com/en-us/office/vba/api/access.docmd.transferspreadsheet
karenlorr_uk
Apr 06, 2021Copper Contributor
I worked it out
I just did the right click export, then saved the export with a name “export_to_excel”
Then added a button with this
DoCmd.RunSavedImportExport " export_to_excel "
I just did the right click export, then saved the export with a name “export_to_excel”
Then added a button with this
DoCmd.RunSavedImportExport " export_to_excel "