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

I Created a 'Sample.Dll' and 'sample.tlb' file containing a function which returns a value, using Visual Studio 2005 class library for access it in the Microsoft Office Excel's Macro to getting a cells value.
I Set some properties in visual studio 2005 before building the Solution.the Changes are:
- 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)

I Build the Solution and There is three files in the Release folder
- Sample.Dll
- Sample.tlb
- Sample.snk
- sample.Pdb
- sample.xml

Now i place the 'sample.dll' and 'sample.tlb' in the System32 then register the sample.dll on the another machine two times
1. by gacutil /i sample.dll
2. by RegAsm sample.dll

Now I Open the Excel then Create a Macro and add a reference of the 'sample.tlb' from system 32 and Microsoft ActiveX Data Objects 2.1 Library and Microsoft DAO 3.6 Library.
now i create a object of the class file of the DLL.

It returns value in the same machine where the sample.Dll build but on another machine it gives an error when executes the Function and did not return the value of that cells.
the function gave Error Code.
1.Error Code 429
2.Error Code -2147024894

I researched on that two error but did not got any strong result.
why it occurs in any other machine where i did not compile it?
or What step i did not perform.

Thank You,

1 solution


Have you tried moving the files (on the offending machine) to where the excel exe is? I've gone through DLL hell before and usually it's a case of the application not 'finding' the DLL (even when you put the DLL in the system32 folder).

The reason why it would work on the machine that it was compiled on is because when you compile the DLL, somewhere along the line it does some installation stuff for the DLL which allows it to work when you run excel. At least that's what I've found in my experience. I would also suggest that you create a virtual machine that you can test your stuff on and at least then you will have a 'clean machine' where you can play around :).

Hope that helps :)
Share this answer

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