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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exporting table to certain excel worksheet 1

Status
Not open for further replies.

phil009

Technical User
Jun 2, 2004
63
US
I am stuck right at the end of this database and I just need a little bit of help. After I have entered all my information into my form I run a macro which generates query results. What I would then like to do is export these results to an excel workbook that I already have made, just make it create a new sheet at the end. I am using the "Output To" command in the macro but I guess I'm not sure if I should use this or the "TransferSpreadsheet" command and what path to send the file as. If anyone can help me with this it would be greatly appreciated. Thanks
*An example would be: I am trying to send the results to G:\All\Phil\Book1.xls and just adding it in as the last sheet. Is there any way of doing this? Thanks again
 
DoCmd.TransferSpreadsheet works wonderfully.

If you do not already have a sheet in the workbook with the same name as the query, the TransferSpreadsheet method will automatically do what you require (it will create a new sheet at the end with the same name as the query).

So something like this works great:

DoCmd.TransferSpreadsheet acExport, , "Query2", "G:\All\Phil\Book1.xls", True

-Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top