Macro error

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Macro error

Post by matthewR »

I have the following code (that used to work fine). It is giving me an error - external table is not in the expected format. All I am doing is exporting the queries to an Excel workbook.

Private Sub Expqueries2_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "03_CntByProduct_CompPPO2", "V:\CORPDATA17\Admin\Linda\DelawareReportExcelFolder\MyWorkbook2.xlsx", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "03_CntByProduct_BlueCare2", "V:\CORPDATA17\Admin\Linda\DelawareReportExcelFolder\MyWorkbook2.xlsx", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "03_CntByProduct_First State Basic PPO2", "V:\CORPDATA17\Admin\Linda\DelawareReportExcelFolder\MyWorkbook2.xlsx", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "03_CntByProduct_CDHGold2", "V:\CORPDATA17\Admin\Linda\DelawareReportExcelFolder\MyWorkbook2.xlsx", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "03_CntByProduct_Medicfill2", "V:\CORPDATA17\Admin\Linda\DelawareReportExcelFolder\MyWorkbook2.xlsx", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "03_CntByProduct_POS2", "V:\CORPDATA17\Admin\Linda\DelawareReportExcelFolder\MyWorkbook2.xlsx", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "03_CntByProduct_All2", "V:\CORPDATA17\Admin\Linda\DelawareReportExcelFolder\MyWorkbook2.xlsx", True
MsgBox "All reports have been exported to Excel.", vbInformation
End Sub

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Macro error

Post by HansV »

Which line causes the error?
Best wishes,
Hans

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Macro error

Post by matthewR »

The second Docmd

User avatar
HansV
Administrator
Posts: 78463
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Macro error

Post by HansV »

If the first one works, there may be something wrong with the second query you're trying to export, 03_CntByProduct_BlueCare2. Can you open this query without problems?
Best wishes,
Hans