Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DoCmd.TransferSpreadsheet: export from query to excel sheet through VBA

2,057 views
Skip to first unread message

jayakrishna

unread,
Apr 4, 2008, 2:50:32 AM4/4/08
to
Hi,
I want to export data from a query to excel sheet using
DoCmd.TransferSpreadsheet.
The starting cell should be 6 row and ending cell depends on the
result by the query.

Please help me in indicating the range in DoCmd.TransferSpreadsheet
command

for e.g.
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
Me.Combo_WorksheetList, [txt_file_path], False,
Me.Combo_WorksheetList.Value + "!"+ "Range??"


In the above statement how to select the range.

Thanks
Jay

Alex Dybenko

unread,
Apr 4, 2008, 4:15:10 AM4/4/08
to
Hi,
have a look here:
http://accessblog.net/2006/07/export-to-excel-range.html

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"jayakrishna" <jayakris...@gmail.com> wrote in message
news:175ba531-2a24-42b7...@i12g2000prf.googlegroups.com...

fredg

unread,
Apr 4, 2008, 11:20:43 AM4/4/08
to

Did you not read VBA help on the TransferSpreadsheet method?

Range Optional Variant. A string expression that's a valid range of
cells or the name of a range in the spreadsheet. >>> This argument
applies only to importing. Leave this argument blank to import the
entire spreadsheet. When you export to a spreadsheet, you must leave
this argument blank. If you enter a range, the export will fail.<<<

I would just export to a worksheet (the worksheet will have the same
name as the query you exported), then use a macro within Excel to cut
and paste the data to where I want it.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

0 new messages