Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

We will just want to describe you of what we are trying to achieve. We are trying to compile a class file to a dll which is compatible on 64 bit Operating Systems and 64 bit Processors.Further we are wanting to call a function of this class file in an Excel VBA macro.The dll function returns a value and the macro reads that value and puts it to a specific cell of an Excel File.

We are successfully able to achieve this on machines running 64 bit Operating Systems and 32 bit Office(Office 2003, Office 2007, Office 2010) and 32 bit Operating Systems. We are facing problems only with a combination of 64 bit Operating Systems and 64 bit Office.

The steps we followed to compile the dll is as follows:

I created a class library in visual studio 2008.The properties set in the Visual Studio Editor is as:-

- Application -->Assembly Information-->Make Assembly COM visible Check box Checked.
- Compile --> Register for COM interop Check box Checked(Which creates 'Sample.tlb' file)
- Signing --> Sign the Assembly.Check Box Checked(Which creates 'Sample.snk' file)
- Set the Target CPU as 'Any CPU' and Target Framework as 'Microsoft framework 2.0' Advanced Compiler Setting

As we build the solution, following files get created in the Release folder.

- Sample.Dll
- Sample.tlb
- Sample.snk
- sample.Pdb
- sample.xml

Now I place the .dll file and .tlb file in system 32 and syswow64 folder.
and then registered the dll as denoted below.-

1. by gacutil /i sample.dll
2. by RegAsm sample.dll

After Registering DLL I Open the Excel then Create a Macro and add a reference of following files-
- .tlb file
- Microsoft ActiveX 6.0 object library(for 64 bit MS Office Excel)
-'Microsoft Office 14.0 Access Database Engine Object'
- Microsoft DAO Object Library 3.6


I create an object of the dll and call the dll function via the object created.

The problem we face is an Error code "429" at the point when in the Macro we call the dll function(Note: on machines with 64 bit Operating System and 64 bit Office). We researched a lot on this issue,but still could not resolve the same. Please, kindly help us address this issue with workaround.

Thank You,

Regards,

Vaibhav Pandya
Posted
Updated 15-Mar-12 19:46pm
v4
Comments
André Kraak 3-Mar-12 8:40am    
Edited question:
Replaced txt speak
Removed unnecessary tags

1 solution

This sounds like a 32bit/64bit file/dll conflict.
 
Share this answer
 
Comments
nigam.anant 4-Mar-12 3:00am    
Then where I get the 64 bit "Microsoft DAO 3.6 Object Library".Iresearched alot for 64 bit DLL.or any alternative of it.
richardw48 4-Mar-12 3:18am    
I think you can use ACEDAO.DLL instead of "Microsoft DAO 3.6 Object Library" because the DAO36.DLL is not 64bit compatible
richardw48 5-Mar-12 9:38am    
Why did you have to download ACEDAO.dll? If you have MS Office on your computer then the dll can be found in C:\Program Files\Microsoft Office\Office14\

I suspect you might have downloaded the wrong version of the dll. Try adding a reference to the dll in the above folder.

Please can you share some of your code so that we can see what you're trying to achieve?
richardw48 6-Mar-12 12:05pm    
Thanks for the summary. The references to Microsoft Active X 2.1 Object Library and Microsoft DAO 3.6 Object Library are 32bit dlls so will not work with Office 64bit even if you compile them into a 64bit dll or set as 'Any CPU'. The 64bit version of Microsoft Active X 2.1 Object Library is Microsoft Active X 6.0 Object Library. There is no 64 bit equivalent for Microsoft DAO 3.6 Object Library. Depending on the functionality required you could try setting a reference to C:\Program Files\Common Files\Microsoft Shared\Office14\ACEDAO.dll This will show as 'Microsoft Office 14.0 Access Database Engine Object' but it may no give you the required features. Where is the data being obtained from? An Access database, SQL Server or a different source?
richardw48 7-Mar-12 9:05am    
It would help if you could include an extract of the code you're using to create the ActiveX object.
Also look here: http://support.microsoft.com/kb/828550

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900