Results 1 to 2 of 2
2008-09-29, 03:12 #1
- Join Date
- Sep 2001
- Stuck at work..., Missouri, USA
- Thanked 0 Times in 0 Posts
Export to Excel with Multiple Tabs (2003)
I have code that will export a table or query to Excel and can split it into multiple FILES based on a field in the data.
What I need to do now is export to Excel and split into multiple TABS based on a field.
Pointers?<font face="Comic Sans MS">Morgan Erickson</font face=comic>
<img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.
2008-09-29, 03:59 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: Export to Excel with Multiple Tabs (2003)
When you export to an existing workbook, Access will export to a sheet with the same name as the table or query being exported. If this sheet doesn't exist, it will be created, and if it already exists, it will be overwritten.
So one option is change the name of the table/query each time, so that the data will be written to different sheets.
Another option is not to export from Access, but to import into Excel, using the CopyFromRecordset method - look it up in the Excel VBA help, there's a complete example.