VBA export to Excel tab

JH40

Registered User.
Local time
Today, 00:13
Joined
Sep 16, 2010
Messages
100
Hi all. I'm using the following to export query results to Excel:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "QryFinalRawExportTbl_SWD", "P:\SWD\IP\TemplateSWD.xls"

Can someone tell me what further is needed to direct it to a specific excel tab? I will be exporting multiple queries into different tabs of the same excel template, and I want to direct it to the correct tab. Hopefully this is a simple step I am missing, but I may be being overly optimistic! :)
 
One way is to take this code:
http://www.btabdevelopment.com/ts/tq2xlspecwspath

and paste it into a STANDARD MODULE (not a form, report, or class module) and then you can simply call it like:

SendTQ2XLWbSheet "QryFinalRawExportTbl", "TypeTabNameHere", "P:\SWD\IP\TemplateSWD.xls"

and replace what I put "TypeTabNameHere" with the name of your actual tab and leave it in quotes.
 

Users who are viewing this thread

Back
Top Bottom