Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Multiple Tables To Excel

Status
Not open for further replies.

Krukloaf

Programmer
Jun 28, 2002
9
US
Does anyone know of a way that you can export multiple tables to the same excel spreadsheet?
 
Unfortunately, the TransferSpreadsheet Action can not export to a specified worksheet within a Excel table.

So off the top of my head, you can do one of three things:
(1) Brute force (not pretty)
Create code in Excel that will goto each worksheet and copy/paste the data range into a single worksheet. Then save the workbook as a template. Export all of your tables to the workbook. Finally, open a object variable to Excel that will call the procedure to combine the worksheets.

(2) Prettier and more complex (but takes some time to code)
Create a Object Variable to MS Excel and include MS Excel library within your references.
Create a new workbook or open an existing workbook.
Loop through each of the tables and using variables as your reference points in Excel, assign the values to the proper cells.

(3) Very Simple (As long as you don't need formulas)
MS Excel can open CSV files which is a text file.
Create a text file and use the "Write #" statement to append your data to a common text file. Make the data comma delimited values.


-Doug



 
wow, thanks, I'll start with the 3rd option because I don't require any formulas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top