Connecting Tech Pros Worldwide Forums | Help | Site Map

using C# dll as COM

Thomson
Guest
 
Posts: n/a
#1: Jan 2 '06

I have created a dll in C# . I have to use it as a COM
for my Excel work sheet
while adding code for a worksheet ( it is an option in Microsoft Excel
that we can add code for worksheets to execute while using work
sheets ) . But when I triy to add a reference to the dll it shown
some error like " can' t add reference to this file "

Can any one say , What I have to do ?

Any suggestion will be appreciated ,


Regards ,

Thomson


Bruno van Dooren
Guest
 
Posts: n/a
#2: Jan 2 '06

re: using C# dll as COM


do the following:

regasm mydll.dll /tlb:mydll.tlb
mydll should be the name of your dll, obviously.

that will create a type library fore your dll, which will then be
registered. the library will then automatically appear in the list of
available references of excel VBA.

see
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cptools/html/cpgrfassemblyregistrationtoolregasmexe.htm
and
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconexposingnetframeworkcomponentstocom.htm
for more info.

kind regards,
Bruno.



"Thomson" <thomsoncd@gmail.com> wrote in message
news:1136204224.920973.237960@f14g2000cwb.googlegr oups.com...[color=blue]
>
> I have created a dll in C# . I have to use it as a COM
> for my Excel work sheet
> while adding code for a worksheet ( it is an option in Microsoft Excel
> that we can add code for worksheets to execute while using work
> sheets ) . But when I triy to add a reference to the dll it shown
> some error like " can' t add reference to this file "
>
> Can any one say , What I have to do ?
>
> Any suggestion will be appreciated ,
>
>
> Regards ,
>
> Thomson
>[/color]


Thomson
Guest
 
Posts: n/a
#3: Jan 5 '06

re: using C# dll as COM


thanks for your comments ,

I have followed your suggestions , But it needed to be registered
on GAC(Global Assembly Catch ) ,So I did that using " Gacutil.exe "
tool of Microsoft .Net framework . After that it has been registered
with a type library on using " RegAsm /tlb " .Now I can use it as a COM
in VBA of Excel.

Regards ,

Thomson

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Closed Thread