Home All Groups Group Topic Archive Search About

How to Reference a .Net Assembly from within VBA?

Author
27 Oct 2006 3:45 PM
TCook
Hey All,

I want to create an assembly in .Net that I can reference and use in VBA.

I have a sample assembly that I've strongly named and that is loaded in the
GAC.  However, I can not see from within VBA.

Please advise?

Thanks & Regards,

TC

Author
27 Oct 2006 3:48 PM
Scott M.
You don't reference .NET assemblies from COM applications.  You'll need to
register you .NET assembly for COM InterOp and then re-build it.  This will
create a COM Callable Wrapper assembly that you would then reference from
your VBA project as normal.


Show quoteHide quote
"TCook" <getmyemai***@yahoo.com> wrote in message
news:OhLPo7d%23GHA.1172@TK2MSFTNGP03.phx.gbl...
> Hey All,
>
> I want to create an assembly in .Net that I can reference and use in VBA.
>
> I have a sample assembly that I've strongly named and that is loaded in
> the
> GAC.  However, I can not see from within VBA.
>
> Please advise?
>
> Thanks & Regards,
>
> TC
>
>
>
Author
27 Oct 2006 6:57 PM
Herfried K. Wagner [MVP]
"TCook" <getmyemai***@yahoo.com> schrieb:
> I want to create an assembly in .Net that I can reference and use in VBA.
>
> I have a sample assembly that I've strongly named and that is loaded in
> the
> GAC.  However, I can not see from within VBA.

You can implement the functionality in a .NET class library and expose the
functionality for COM interop:

..NET Framework Developer's Guide -- Exposing .NET Framework Components to
COM
<URL:http://msdn.microsoft.com/library/en-us/cpguide/html/cpconexposingnetframeworkcomponentstocom.asp>

Visual Basic Language Concepts -- COM Interop
<URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconCOMInteroperability.asp>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
27 Oct 2006 7:27 PM
TCook
Hey Guys,

Thanks for the advice.  I figured out my problem.  Although I had the class
tagged as a COM class and also had the assembly strongly named, I hadn't
signed the project or registered it for COM interop from within the
project's settings.

Once I signed and registered the assembly and rebuilt it, I was able to use
it from within VBA.

Thanks for the advice.

Best,

TC


Show quoteHide quote
"TCook" <getmyemai***@yahoo.com> wrote in message
news:OhLPo7d%23GHA.1172@TK2MSFTNGP03.phx.gbl...
> Hey All,
>
> I want to create an assembly in .Net that I can reference and use in VBA.
>
> I have a sample assembly that I've strongly named and that is loaded in
> the
> GAC.  However, I can not see from within VBA.
>
> Please advise?
>
> Thanks & Regards,
>
> TC
>
>
>