• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1760
  • Last Modified:

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.
0
marlind605
Asked:
marlind605
1 Solution
 
Rey Obrero (Capricorn1)Commented:
use this


DoCmd.TransferSpreadsheet acExport, 10, "qryalltimerecordsbydate", myfilename
0
 
marlind605Author Commented:
That was the quickest solution I ever got to one of my questions. Thanks.
0
 
Nick67Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now