Solved

MS Access export multiple queries to separate worksheets in Excel workbook

Posted on 2014-03-06
2
5,212 Views
Last Modified: 2014-03-06
I am currently using docmd.output to and exporting various queries in to separate Excel workbooks. Ideally I would like to export these queries to separate worksheets within one workbook and name the worksheets with the same name as the query.

This is what I do currently.

DoCmd.OutputTo acOutputQuery, "Bens CC", "Excel97-Excel2003Workbook(*.xls)", "z:\mi\BensCC.xls", False, "", , acExportQualityScreen
    DoCmd.OutputTo acOutputQuery, "Cab CC", "Excel97-Excel2003Workbook(*.xls)", "Z:\MI\CABCC.XLS", False, "", , acExportQualityScreen

Thanks for any advice
0
Comment
Question by:iainmacleod
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39909301
Hi,


pls try

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Bens CC",  _
"z:\mi\YourFile.xls", True, "Bens CC"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Cab CC",  _
"z:\mi\YourFile.xls", True, "Cab CC"

Open in new window

Regards
0
 

Author Closing Comment

by:iainmacleod
ID: 39909372
Hah, easy when you know how....!  Thanks very much..
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now