DoCmd.TransferSpreadsheet: export from query to excel sheet throughVBA

J

jayakrishna

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
 
F

fredg

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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top