I have a query (qry_Patients-reminder), that I would like to export to the Excel sheet 'Exported_Data' of reminder.xlsm. Currently the code below just opens up the workbook reminder.xlsm, but doesn't paste the data to the sheet. Am I missing something?
Here is my code:
Private Sub Command73_Click()
'This exports the reminder data to reminder.xlsm
Dim strFile As String
strFile = DLookup("path", "tblPath") & "\Reminder.xlsm"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qry_Patients-reminder", strFile, True, "Exported_Data"
Set objXL = CreateObject("Excel.Application")
objXL.Visible = True
Set objWB = objXL.Workbooks.Open(strFile)
objXL.UserControl = True
Set objXL = Nothing