Transferspreadsheet to specific cell

jbphoenix

Registered User.
Local time
Yesterday, 19:20
Joined
Jan 25, 2007
Messages
98
I would like to be able to export data from a query to a specific cell on an excel sheet. I know how to get the data the sheet but can I send it to a specific cell. Here is the code I have to export the data. I would like it to go to cell C10.

Code:
DoCmd.TransferSpreadsheet acExport, , "qry_SA_Randy_SDC_2", "\\S\reports\Sales\2009\SA\EMG2009 Randy.xls", False, "KPI"
 
You can export to a range like this:

DoCmd.TransferSpreadsheet acImport, 8, "Customers", pathToSpreadsheet, True, "MainSheet!C4:E6"

You can export to a named range by assigning the same name to the range as to the query:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryExcelData", pathToXLS, True

If you use an ADODB command object, with an OLEDB connection string to Excel (maybe even an OBDC string might work), you can probably export to a named range like this:


INSERT INTO rangeCustomers (FirstName,LastName) VALUES (......
 

Users who are viewing this thread

Back
Top Bottom