Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb) ODBC driver for .xlsx files

常规讨论 Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb) ODBC driver for .xlsx files

  • Thursday, July 02, 2009 4:58 PM
     
     

    Hi,
    This is proably the wrong forum, but I will ask.

    I created a new Excel 2007 .XLSX file via the ODBC Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb) driver. When I opened the file, I received the following message:

    Excel cannot open the file 'myexcel.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the file format.

    My connect string is:

    DBQ=c:\temp\myexcel.xlsx;Readonly=False;DefaultDir=c:\temp;DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};FIL=Excel 12.0;DriverID=1046;UID=admin

    The file gets created fine and  I am able to write data to it. The only issue is the format is a .xlsb binary format instead of a .xlsx format. Is this a limitation? I have read a post that states that the ODBC driver is creating the .xlsx file as a .xlsb (binary format) and to rename the .xlsx to a .xlsb file. S I renamed the file from .xlsx to .xlsb and behold it worked. I thought the issue was the Readonly so I took it out of the connection. The problem still occurred. I have even tried to not use the UID to no avail.

    Does anybody know the exact connect string to use to write to a excel 2007 .xlsx file? Renaming the file to a .xlsb is not feasibly. We would like to do this programmicatally. 
     

    • Changed Type DennisRuss Thursday, July 02, 2009 7:15 PM I can not find the correct forum.
    • Moved by Cindy Meister MVPMVP Friday, July 03, 2009 6:32 AM not VSTO-related (From:Visual Studio Tools for Office)
    •  

All Replies

  • Thursday, July 02, 2009 5:15 PM
     
     

    Hi Dennis

    You're right, this isn't the right place to ask :-)

    Have you tried
    - excel.programmingvenue newsgroup or other Excel-specific
    - data.odbc newsgroup
    - Innovate on Office forum

    You'll find links to all of these in the Please Read First message (but you need to go over "all newsgroups" for the data.odbc one)


    Cindy Meister, VSTO/Word MVP