GeoffS Level: VB Lord

 Registered: 29-09-2004 Posts: 607
|
Re: Export to Excel
Access has a built in function for this. - DoCmd.OutputTo
You can use this function to output most objects from Access, including Queries, to most formats used in the main Microsoft Office products - i.e. Word and Excel.
So, if your subform is based on data from a Query then all you need to type in your vba code is:-
DoCmd.OutputTo acOutputQuery, "Query1", acFormatXLS, "C:\tmp.xls", False
|
If you highlight the OutputTo and hit F1 then Help will give you more detail.
____________________________
multi-tasking - the ability to hang more than one app. at the same time.
|