-
Output to Excel Sheet
Hi All,
I am after some advice, I need to output the contents of an access query to a new excel worksheet. I also need to generate a new worksheet for each new record I pull from the query I am using.
Does anyone have a sample of the best way to achieve this or able to offer any tips.
I am a vb developer but I don't do much with Access and Excel.
Any help or advice appreciated.
-
Hey,
OK, what you'll want to do is first create a Macro in Access. It should have two lines in it:
1. OpenQuery (with the name of the query you want to run)
2. OutputTo (with Object Type as Query, Object Name (your query), OutputFormat as Excel and OutputFile with the path and file name you want exported to.
This will export all of the records.
In Excel, you'll just create a simple Macro that goes down and cuts every line and pastes it to a new worksheet. If you need the code for this, let me know.
-Joshua Wise
-
Thanks for your reply,
the code for the excel macro would be great.
many thanks
dagoose