Exporting to existing Excel workbook (1 Viewer)

tmyers

Active member
Local time
Yesterday, 21:00
Joined
Sep 8, 2020
Messages
692
I have been trying to research this, and while I have found various methods to move data from Access into Excel using TransferSpreadSheet, how can I control the range in which the data gets inserted?
I have a template that has a header and named columns further down and such, so I would need to control what row/column that data would be inserted at. Could someone provide a quick example that I could look at to get an idea?
 

Isaac

Lifelong Learner
Local time
Yesterday, 18:00
Joined
Mar 14, 2017
Messages
5,052
Glad you found something that seems to be sufficient. I've had very good results with CopyFromRecordset.
Once it's done I just loop through the DAO Fields of the recordset to handle the headers.

Code:
dim fld as dao.field, rng as object
set rng=yourworksheetvariable.range("A1")

for each fld in yourrecordsetobject.fields
     rng.value=fld.name
     set rng=rng.offset(0,1)
next fld
 

Users who are viewing this thread

Top Bottom
日韩精品亚洲专区在线影院