Over the years, I have answered numerous questions regarding how to export a records, or records to either MS Excel or MS Word. I already have 2 posts on the subject:
but thought a concrete example would help illustrate things even further.
Here are a few screenshots of the sample.
Now in this sample I am covering Excel and Word automation, not built-in commands, such as:
- DoCmd.TransferSpreadsheet
- DoCmd.TransferText
- DoCmd.OutputTo
- DoCmd.RunCommand acCmdExportRTF
These are well documented, and plenty of examples can be found online. Instead, I concentrate on demonstrating a few possible ways to export using late binding and word and excel automation, permitting much more control on the final product (font, colors, layout, page orientation and so much more) and no need for any external reference libraries.
Note: for this sample to work, all the supporting files (excel and word) must be in the same folder as the database itself (although this very easy to change in the VBA code provided).
Fill In Excel Or Word Access Demo








