using C# dll as COM

T

Thomson

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
 
B

Bruno van Dooren

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.
 
T

Thomson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top