Code Snippets → Export a Form’s Recordset to Excel – To an Existing Worksheet

Copy this code into a standard (not form or report) module. Name the module something other than this function name and make sure to set a reference to DAO if you don’t already have one.

You can then call it like this for a form (if the code is on the form you want then):

To use it with a form which the code is not on use (the form must be open):

To use it with a subform and the code not be on the subform:

Just a note – SubformControl means the control on the main form which houses the subform and not the subform name itself (unless they share the same name).