Export a DAO Recordset to an Excel Spreadsheet

Category:
Database
Type:
Snippets
Difficulty:
Intermediate

Author: Marko Hernandez

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
Requires a reference to DAO and Microsoft Excel Object Library Version 9.0 (the one that ships with Excel 2000). Will also work with Excel 8.0 object library (Excel 97), except for some of the file formats specified. If you have Excel 97, change the to formats to match those in the 8.0 library or use the default values as parameters.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: