Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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.
Cells(1,1)=object.Function()

 
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 3:11am

1 solution

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

Solution 1

Hi,
 
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 Smile | :) .
 
Hope that helps Smile | :)
  Permalink  
v2

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

  Print Answers RSS
0 Maciej Los 225
1 OriginalGriff 145
2 manoj kumar choubey 115
3 _Amy 115
4 Sergey Alexandrovich Kryukov 105
0 OriginalGriff 7,320
1 Sergey Alexandrovich Kryukov 6,043
2 Maciej Los 3,749
3 Peter Leow 3,408
4 DamithSL 2,555


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 3 Mar 2012
Copyright © CodeProject, 1999-2014
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