Distributing and referencing .NET dll from Access

winshent

Registered User.
Local time
Today, 15:02
Joined
Mar 3, 2008
Messages
162
Hi Guys

I've built a basic .NET dll and am trying to reference it...

I've followed the instruction on this link..

http://www.geeksengine.com/article/create-dll.html

The instructions have worked on my machine (I have VS 2010 installed), but when trying to get it registered on my colleagues machine who has same build, it doesn't work..

'The system cannot find the file specified' when the object is initialized in VBA.

Any ideas?
 
Did you register the DLL on the new machine using regasm?
 
also after you register it. make sure the dll is in the same location as displayed as in the example under the registry setting codebase. You can double check this in the reference window when you highlight the code library as in the instructions...

"You may remember in the registry screenshot above, there is a DLL path value in CodeBase entry. VBA will use this registry information to find which DLL to call. In our case, it's D:\CSharp\SimpleCalc\SimpleCalc\bin\Release\SimpleCalc.dll
 
Did you register the DLL on the new machine using regasm?

Yep

also after you register it. make sure the dll is in the same location as displayed as in the example under the registry setting codebase. You can double check this in the reference window when you highlight the code library as in the instructions...

"You may remember in the registry screenshot above, there is a DLL path value in CodeBase entry. VBA will use this registry information to find which DLL to call. In our case, it's D:\CSharp\SimpleCalc\SimpleCalc\bin\Release\SimpleCalc.dll

Yep..

Started from scratch and went thru the full procedure.. Now have a different error..

'ActiveX component can't create object'..
 
Code:
regasm.exe FILENAME /tlb /codebase

This always works for me when registering .NET dlls for use in VBA.
 
One thing to consider is that if you are on a 64-bit OS, you need to be sure you're using 32-bit regasm and not 64-bit regasm.

32-bit regasm:
Code:
C:\Windows\Microsoft.NET\Framework\v2.0.5727\regasm.exe

64-bit regasm: (the only time you would use this is with 64-bit Access 2010. Otherwise, don't bother)
Code:
C:\Windows\Microsoft.NET\Framework64\v2.0.5727\regasm.exe

Of course, that is assuming you used .NET 2.0 framework to build your DLL. if it's a later version, your regasm must match the version so change the folder "v2.0.5727" accordingly.
 
Code:
regasm.exe FILENAME /tlb /codebase

This always works for me when registering .NET dlls for use in VBA.

Thanks DJKarl.. This worked !!

Cheers Banana.. thats useful to know..
 
One more thing..

Should intellisense work all of the methods within the dll ?
 
and if the public ones are member of a COM interface as well. If you don't have an interface, then your DLL can only be late-bound.

I wrote an example some years ago that discusses the requirement to enable early binding.
 

Users who are viewing this thread

Back
Top Bottom