This sample db demonstrates export of access queries to excel. If desired, pivot
tables based upon exported data, also get created in the destination file (The
destination files are stored in a folder named ExportedExcelFiles, located within the
parent folder containing the sample db).
Queries meant for export are displayed in multi-select list box. If multiple selection
is made, bulk export takes place, data from each selected query going to a
separate sheet in destination workbook.
For queries where pivot table view is also required at excel end, names of pivot
fields (row field, column field, data field) appear in appropriate columns in the list
box. For other queries (not requiring pivot table view) these columns appear blank.
If multi-selection includes a mixture of both types of queries, data from all queries
gets exported, while pivot tables at excel end get created only for queries having
distinct values for pivot fields as displayed in the list box.
Depending upon user's choice, optional template can be used for creating the
destination excel file. For this demonstration, the template file is located along with
sample db in the same home folder.
While suitable titles are inserted programmatically for all pivot table sheets, similar
action for sheets holding exported data is implemented only if no template has been
used. All utilized sheets (data as well as pivot table) get renamed as per respective
exported queries. Exported data blocks are highlighted in color & provided with
suitable borders.
References:
(a) Microsoft Excel Object library (version 9.0 or later)
(b) Microsoft Scripting RunTime
(c) DAO 3.6 Download Access 2K/XP/2K3: http://www.rogersaccesslibrary.com/forum/uploads/37/ExportAccessToExcelAsPivotTable.zip - uploads/37/ExportAccessToExcelAsPivotTable.zip
------------- --
Email: mailto:adtejpal@gmail.com - adtejpal@gmail.com
|