Posted on 2003-11-12
Last Modified: 2011-08-18
To export an Orders report to Excel, I use:
DoCmd.OutputTo acOutputReport, "report_ORDERS", acFormatXLS, "C:\ORDERS.xls".

When I open the Excel file I get the error message: "REPAIRS TO ORDERS.XLS"

In the error log, it logged "Renamed invalid sheet name"

What should the sheet name be, or is there an extra formatting routine required?

Question by:jjjtuohy
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
  • 3
  • 2
LVL 32

Expert Comment

ID: 9732372
In a default built book this should be "Sheet1", "Sheet2" and "Sheet3"

The fact that you are outputting a report format to a spreadsheet might be part of the problem.
Normally you would output a table or query.

Author Comment

ID: 9732573
That's a clean result Jack; I output the underlying query and used acOutputQuery. I'll use that in future.

The technical puzzle still stands though:
(1) The Output-Object-Type list does include acOutputReport.
(2) The original report data did correctly export to Excel. Excel only moaned about having to rename an invalid sheet name to "Recovered-Sheet 1".
LVL 32

Accepted Solution

jadedata earned 125 total points
ID: 9732659
Just because you CAN do a thing, doesn't mean you SHOULD do a thing....

To keep your excel output looking pretty, investigate the use of CopyFromRecordset.  I have found this method to be the BEST way to build new, or fill templated XLS worksheets from a pre-built query.  It is used against an Excel Object, which exposes all the properties and methods of Excel during the operation for things like adding a summary total row across the top of a worksheet, a custom column header row, using the autofilters and autofit methods to really "spank" the book into the shape I want to see it in.

Author Comment

ID: 9732801
That was a Eureka moment! I didn't think of extracting from the outside. I'm assuming that a DAO database cannot be accessed externally without password.
On a side note I'm puting up 300 on a separate question "Suppress Conflict Viewer" and hope that you can help.
LVL 32

Expert Comment

ID: 9732840
thanx for the question!

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

759 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