Valued Mentor
410 Posts
28 Kudos
Registered: ‎01-27-2010
Post 1 of 5

ConnectionString failure W7 x64

489 Views, 4 Replies
03-30-2012 04:17 AM

hi. i need a solution for my problem :


I have one pc with W7 64b and autocad v2010 64b but i have too many PC with Xp 32b with autocad 2010 32b


so i could use for 64b W7 : 

conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
                               NomFichier & ";" & _
                               "Extended Properties=""Excel 12.0;HDR=YES;"""

 --> error on this PC


but this PC have only office 2007 32b  so i can use driver OLEDB with 64b compilation i have installed the driver for 2007 but this package have only 32b feature. 

So i have dll the package office 2010 acces retr...  with 64b feature. BUT i cant install it.. --> the office installed is 32b only.   I need to buy the office 64b v2007 or 2010 for have the 64b feature on the driver.....


.. So i want to clear all this. The Question :

How i can create a .XLS with :

- VS2010 compil option : Any CPU

- PC on W7 64b + office 2007 32b

- PC on Xp 32b + office 2007 32b


--> I think too create a file .CSV.....   Excel or other... It's annoying.

I think to create a macro directly on EXcel...

I can too create a link directly on Autocad and Excel but i dont know how.


Any idea ?

*Expert Elite*
1,286 Posts
37 Kudos
Registered: ‎06-21-2004
Post 2 of 5

Re: ConnectionString failure W7 x64

03-30-2012 06:48 AM in reply to: AubelecBE

You could always just use com to connect to excel.

add reference to Microsoft Excel ##.0 Object Library


Imports Microsoft.Office.Interop.Excel
Imports Excel = Microsoft.Office.Interop.Excel

       Dim excelApp As New Excel.Application
        Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add(System.Reflection.Missing.Value)
        If Not excelBook Is Nothing Then
               excelBook = excelApp.Workbooks.Open(ExcelFile)
    end if


This may also help.



(defun botsbuildbots() (botsbuildbots))
*Expert Elite*
1,084 Posts
215 Kudos
Registered: ‎04-27-2009
Post 3 of 5

Re: ConnectionString failure W7 x64

03-30-2012 07:08 AM in reply to: AubelecBE

Let make sure that your problem is the ConnectionString fails in your AutoCAD process, because your AutoCAD is 64bit.


Since you use Office2007 32bit and 64bit AutoCAD, that is the source that cause this issue.


Let me try to explain:


When using MS Office, Microsoft recommends use 32bit version over 64bit version. That is what you have. However, you are running AutoCAD 64bit. In your CAD add-in, if you need to access data in *.mdb/*.accdb/*.xls(x), you need to install MS Access 12.0 DB Engine 64bit (because the in-process AutoCAD addin).


However, Office2007 does not allow you to install 64-bit MS Access 12.0 DB Engine. That is why the ConnectionString failed to establish the Connection. In oder to install 64bit MS Access 12 DB Engine, you need to remove Office 2007 32bit. If you have to use MS Office (of course you do, right), you need to install 64bit Office2007 (in the risk some of your Office 2007 VBA customization being broken).


Well, things changed with Office 2010. With Office 2010, you CAN install 64bit MS Access 12.0 DB Engine and 32-bit Office 2010 in the same box. You need to install the 64bit Access DB Engine first, and then install 32-bit Office 2010. Then your Acad add-in will be able to use 64bit MS Access DB Engine to access data in Acess DB or Excel sheet.


The other option to access data in Excel sheet would be to use Open XML to access *.xlsx file. OpenXML is a open standard to access MS Office document (Word/Excel sheet/PowerPoint Doc...), very easy to use and you can completelt avoid the 32/64bit issue here. Since your targeting users have 32/64bit mixed environment, using OpenXML seems a better choice.


Lastly, if you merely use Excel sheet as data store (not for data presentation, analysis), it is usually not a good choice, especially when the data value grows along the time. Moving data into real DB system would be more future-proof.

Valued Mentor
410 Posts
28 Kudos
Registered: ‎01-27-2010
Post 4 of 5

Re: ConnectionString failure W7 x64

03-30-2012 12:34 PM in reply to: norman.yuan

yanks for reply so i have to leran how use OpenXml..

Google  I come: p Have you a goose site for learn it ?

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!