Click here to Skip to main content
12,831,378 members (29,602 online)
Rate this:
Please Sign up or sign in to vote.
See more: MS-Excel DLL macros
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,
Posted 3-Mar-12 4:11am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


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 :)

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170326.1 | Last Updated 3 Mar 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100