Calling .Net DLL functions in Excel 2003

  • Thread starter Thread starter Grumpy Aero Guy
  • Start date Start date
G

Grumpy Aero Guy

Is it possible to call functions wrapped in a DLL created via VS 2003
(Academic) from within an Excel 2003 Module via VBA (Declare Statement in
Excel VBA)?

I know this works with DLLs wrapped with VB6.0P.

I have looked on MSDN, but have no clue where to start searching.
 
Grumpy Aero Guy said:
Is it possible to call functions wrapped in a DLL created via VS 2003
(Academic) from within an Excel 2003 Module via VBA

Yes. Enable the "Register for COM interop" checkbox in the project
properties. Compile the project. Add a COM reference to the interop type
library (TLB) that has been created for the .NET DLL.
(Declare Statement in Excel VBA)?

No, simply add a reference to the type library (not the DLL file).
 
Works GREAT...

I really appreciate your concise and knowledgeable answers.

Now, is the type library "independent", or does the DLL need to be there as
well, once reference is set ... (?)

Enquiring minds want to know :-)

Frank B.
 
The type library only defines the interface that is contained in the dll

So the answer is you need the Dll ( not necesary is the type library , as
it is only handy for developers who can set a reference to it without
actually installing the app on the dev system )


P.s.

Note that you need to use regasm to register the .Net COM assembly on
target systems ( on your dev machine VS.net takes care of that )


regards

Michel Posseth
 
Back
Top