Hi, I have a question about exporting an Access query to Excel using VBA.
When I run the code, the Excel workbook that is created defaults to the name of the query.
I use naming conventions for my queries so the tab of the Excel spreadsheet is named "qryProviderAuditExport". I would like to name it "Provider Report". Is there a way to do this.
It is one spreadsheet that is created when the code is run and there is only one tab to worry about. Here is my code so far:
Dim file_name As String
file_name = CirrentProject.Path & "\Submitter_Audit_Report.xls"
DoCmd.OutputTo acOutputQuery, "qryProviderAuditExport", acFormatXLS, file_name, True
If possible, I would like to do this during the export without having the code open the Excel spreadsheet and doing it after the fact.
Thanks!
When I run the code, the Excel workbook that is created defaults to the name of the query.
I use naming conventions for my queries so the tab of the Excel spreadsheet is named "qryProviderAuditExport". I would like to name it "Provider Report". Is there a way to do this.
It is one spreadsheet that is created when the code is run and there is only one tab to worry about. Here is my code so far:
Dim file_name As String
file_name = CirrentProject.Path & "\Submitter_Audit_Report.xls"
DoCmd.OutputTo acOutputQuery, "qryProviderAuditExport", acFormatXLS, file_name, True
If possible, I would like to do this during the export without having the code open the Excel spreadsheet and doing it after the fact.
Thanks!
Last edited: