Export Access query to defined Excel spreadsheet

Hello,

I have a query that I would like to export to a specific sheet within an Excel workbook. Is this possible? Below is my macro code
Function mac_excel_patient_export()
On Error GoTo mac_excel_patient_export_Err
 
    DoCmd.TransferSpreadsheet acExport, 10, "qry_excel_patient", "c:\test\data.xls", True, ""
 
 
mac_excel_patient_export_Exit:
    Exit Function
 
mac_excel_patient_export_Err:
    MsgBox Error$
    Resume mac_excel_patient_export_Exit
 
End Function

Open in new window

DozingquinnAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:

  DoCmd.TransferSpreadsheet acExport, 10, "qry_excel_patient", "c:\test\data.xls", True,"SheetName"
 
0
 
DozingquinnAuthor Commented:
Thanks for your skills
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.