?
Solved

MS Access export multiple queries to separate worksheets in Excel workbook

Posted on 2014-03-06
2
Medium Priority
?
5,576 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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