How do I resolve a type 13 mismatch error when exporting data from Access to Excel?

24 Views Asked by At

I'm trying to run this code to export data from a number of Access queries into multiple worksheets on a single Excel file, but I'm getting a run-time error 13: type mismatch. Any thoughts on how to resolve the issue?

Here's my code:

Sub ExportNSS()

 Dim strFilePath As String
    strFilePath = "H:\FINANCE\SCHFIN\Planning\"

DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSdaypctquery", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSdaypctbudgetquery", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_admn", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_1435", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_2000s", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_attendancehealth", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_food", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_bene", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_bene", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_athl", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_maint", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_bene", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_insu", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_reti", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_rent", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_actexp_rans", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSactexp_tuit", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSactexp_charteraid", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSS_carryforward", strFilePath + "NSSQueries.xlsx"", True"
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_budgetedrev", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSmuniPYSch19_all", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSmuni_actexp_tuit", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSschcomm_budget", strFilePath + "NSSQueries.xlsx", True
DoCmd.TransferSpreadsheet acExportacSpreadSheetTypeExcel12Xml, "NSSmuni_budget", strFilePath + "NSSQueries.xlsx", True

End Sub
0

There are 0 best solutions below