Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tj tj is offline
external usenet poster
 
Posts: 71
Default Export Access Tables to Excel Workbook

Hello,

I have two tables in Ms Access, which I want to export using VBA to an excel
workbook.

I know that I can export a table in Ms Access to an Excel workbook using the
command:
DoCmd.OutputTo acOutputTable, "Table_Name", acFormatXLS, "C:\myfile.xls"

Is there a method to export the second table to the same workbook on the
second worksheet? I have been able to do that only using some long method,
which is, opening the workbook, adding a worksheet, selecting it, looping
through the table's fields and writing them down to specific cells, and then
looping through the data in the table, all of which is manual, unlike the
code above.

Will appreciate any input,

Thanks!

Tj

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 180
Default Export Access Tables to Excel Workbook

A little VBA code will open both output files, activate the second, then move
the worksheet to the first file. Move the entire sheet, rather than
cell-by-cell. (You can record most of this by turning on the macro recorder
and going through the steps yourself. To move the sheet, right-click on the
worksheet tab and select 'Move or Copy', then choose the other workbook from
the drop-down.)

"Tj" wrote:

Hello,

I have two tables in Ms Access, which I want to export using VBA to an excel
workbook.

I know that I can export a table in Ms Access to an Excel workbook using the
command:
DoCmd.OutputTo acOutputTable, "Table_Name", acFormatXLS, "C:\myfile.xls"

Is there a method to export the second table to the same workbook on the
second worksheet? I have been able to do that only using some long method,
which is, opening the workbook, adding a worksheet, selecting it, looping
through the table's fields and writing them down to specific cells, and then
looping through the data in the table, all of which is manual, unlike the
code above.

Will appreciate any input,

Thanks!

Tj

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Access, Workbook Treated as a Query Response ConfusedNHouston Excel Discussion (Misc queries) 1 March 3rd 08 08:28 PM
Export to Access from Excel Secret Squirrel Excel Discussion (Misc queries) 0 February 7th 06 11:44 PM
Export from Access to Excel tamxwell Excel Programming 9 June 30th 05 08:31 PM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM
Export from Access to Excel Sabina Excel Discussion (Misc queries) 3 February 23rd 05 09:56 PM


All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"