marlind605
asked on
Microsoft Access 2013 TransferSpreadsheet generates Excel but When it is opened Extension Not Valid Error
I am using the following code to export a query from Microsoft Access 2013
myfilename = "W:\AD_Reports\AnotherTest .xlsx"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryalltimerecordsbydate", myfilename
Everything seems to work but when i try to open the file it gives a message Format or File Extension not valid. I deleted the file and did it over and it still produces the same error. Thanks for any help.
myfilename = "W:\AD_Reports\AnotherTest
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryalltimerecordsbydate",
Everything seems to work but when i try to open the file it gives a message Format or File Extension not valid. I deleted the file and did it over and it still produces the same error. Thanks for any help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you catch what the problem was?
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryalltimerecordsbydate", myfilename
This is the filetype for a .xls export, and you specified a .xlsx filename
Hence the problem
acSpreadsheetTypeExcel9 has a value of 8
Rey had you substitute in 10 to match the .xlsx filetype.
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryalltimerecordsbydate",
This is the filetype for a .xls export, and you specified a .xlsx filename
Hence the problem
acSpreadsheetTypeExcel9 has a value of 8
Rey had you substitute in 10 to match the .xlsx filetype.
ASKER