Home All Groups Group Topic Archive Search About

Calling .Net DLL functions in Excel 2003

Author
19 Jun 2006 10:25 PM
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

Author
19 Jun 2006 10:45 PM
Herfried K. Wagner [MVP]
"Grumpy Aero Guy" <f*@beerme.org> schrieb:
> 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).

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
19 Jun 2006 11:41 PM
Grumpy Aero Guy
Thank you... I'll give it a shot (something else to play with ! )

--
Grumpy Aero Guy



Show quoteHide quote
"Grumpy Aero Guy" <f*@beerme.org> wrote in message
news:fvFlg.76084$YI5.73181@tornado.ohiordc.rr.com...
> 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
>
>
>
>
Author
20 Jun 2006 12:02 AM
Grumpy Aero Guy
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.

--
Grumpy Aero Guy



Show quoteHide quote
"Grumpy Aero Guy" <f*@beerme.org> wrote in message
news:fvFlg.76084$YI5.73181@tornado.ohiordc.rr.com...
> 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
>
>
>
>
Author
20 Jun 2006 8:42 AM
M. Posseth
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



Show quoteHide quote
"Grumpy Aero Guy" wrote:

> 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.
>
> --
> Grumpy Aero Guy
>
>
>
> "Grumpy Aero Guy" <f*@beerme.org> wrote in message
> news:fvFlg.76084$YI5.73181@tornado.ohiordc.rr.com...
> > 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
> >
> >
> >
> >
>
>
>