Hello!
I am using VBA to automate a process of importing and exporting queries. I would like to save a specification type for EXPORTING. I have already saved specification types for my imports. So, once I run the query I go to External Data > Export > Excel.
However once I do this, and I name the file, select file format, select "Export data with formatting and layout" > click ok. Shouldnt the next menu have an advanced option for my specification types? The export wizard is missing..how do I save my spec types for an Export? I'm at a loss, please help!
My VB code is below. I sometimes get an error saying: Run-time error '3274': External table is not in the expected format
I think this has to do with having no spec type saved for Exporting. But I can't figure out for the life of me how to save Export Specifications. HELP!
Sub Export_Queries()
Dim TheDate As String
Dim TheDate1 As String
Dim OutputPath As String
Dim strQryName1 As String
Dim strQryName2 As String
Dim strQryName3 As String
Dim strQryName4 As String
Dim strQryName5 As String
Dim strQryName6 As String
Dim strQryName7 As String
Dim strQryName8 As String
Dim strQryName9 As String
Dim strXLFile1 As String
Dim tblName1 As String
TheDate = Format(Date, "MM-DD-YYYY")
TheDate1 = Format(Date, "MMDDYYYY")
OutputPath = "C:\Documents and Settings\htq972\Desktop\Work Files\POR Reports\POR & PMOR Files\" & TheDate & "\" & "Queries_" & TheDate & "\"
strQryName1 = "EXPORT Overview_Test"
strQryName2 = "Exp_DQ_Final"
strQryName3 = "Export Data Quality"
strQryName4 = "RiskIssueExport"
strQryName5 = "Exp_En_Schedule_Final_Formulas"
strQryName6 = "EXPORT Status -5 wks"
strQryName7 = "EXPORT Oversight"
strQryName8 = "EXPORT RawData-PMOR"
strQryName9 = "PMOR_ComboBoxValues_Use This"
strXLFile1 = OutputPath & "POR Export Raw_" & TheDate1 & ".xls"
tblName1 = "ca-Change Requests Details"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName1, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName2, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName3, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName4, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName5, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName6, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName7, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName8, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strQryName9, strXLFile1, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, tblName1, strXLFile1, True
End Sub