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!

Export 5 Reports to Excel using Macro or code

Status
Not open for further replies.

RPW1

Technical User
Jun 14, 2001
19
US
I Need to send 5 access reports to Excel and know how to do this using tools office links or file save as export. I would like to have anyone in the office be able to have a macro or code to do this.
Thank you!
Bob Woods
 
One way, you can use the "OutputTo" or "TransferSpreadsheet" functions of the "Docmd" object. I would look these items up in the Access Help.

Gary
gwinn7



 
The simplest way to do it is use a macro.. I don't use them much myself as they don't offer versatility, unlike code, though they do offer one benefit - if you are not confident with code, then they make it very easy and can later be converted to code to assist in the learning process.

Goto the macros tab and select the action 'OutputTo'. This will then enable you to select the type of object you want to output - Table/Query/Report/Form etc and what the name of it is in your db. You can then specify which type of output you want - text file, spreadsheet etc etc.. and finally the name / path. There are options to automatically start the application with the document you have just exported if you want. Do this for the 5 reports you want to export and hey presto!

This should do what you want, though if you want to use this in code and dynamically name the file etc then use the convert macros to code option in the tools menu when in the database window view.

One final thing; try using a query instead of a report to output to excel - it is much easier for the users to manipulate - reports can have lots of nasty formatting which can make it difficult to work with in excel.

Damian
damber@damber.net

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top