Hi,
is it possible to call .NET DLL from VBA?
How?

Best regards
Seb

Re: call .NET DLL by Jonathan

Jonathan
Tue May 22 06:50:31 CDT 2007


"Seb" <sebs_78@nospam.hotmail.com> wrote in message
news:4652b7d5$0$5111$ba4acef3@news.orange.fr...
> Hi,
> is it possible to call .NET DLL from VBA?
> How?
>


Only if it has been configured as an ActiveX DLL.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org


Re: call .NET DLL by Cindy

Cindy
Tue May 29 14:18:12 CDT 2007

Hi Seb,

> is it possible to call .NET DLL from VBA?
>
It has to be exposed to COM. Andrew Whitechapel explains
the steps in some detail in his ".NET developement for
Microsoft Office", but in a general way it means

1. Set the project's Register for COM interop to true

2. Generate a GUID to attribute the assembly

3. Write interfaces to expose the methods, assigning each
its own GUID and setting an attribute to be
ComVisible(true)

4. Implement each interface in a public class, also with
its own GUID and with the attribute
ClassInterface(ClassInterfaceType.None) and also make it
ComVisible(true)

5. Strong name the assembly

If you need more help with this, the
dotnet.framework.interop newsgroup is probably a better
place to ask than a VBA newsgroup :-)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)