none
VSTO: How can I access installed Excel COMAddin from Excel template solution without DLL reference ? RRS feed

  • Question

  • Hi All,

     

    I have installed a Excel COMAddin (ex. “ListnerAddin”) in the local machine which is available at Excel Application level.

     

    Now, I am having Excel Template solution (ex. “ListnerTemplate”).

     

    I am able to access the methods and properties of ListnerAddin from ListnerTemplate by referring the ListnerAddin-DLL in ListnerTemplate Solution.

     

    Is there any way to access the methods and properties of ListnerAddin from ListnerTemplate  WITH OUT  DLL REFERENCE.

     

    If you have any idea, please share with me.

     

    Thanks in advance.

    Thursday, March 31, 2011 6:12 AM

Answers

  • Hello,

    You can access your COM add-in via the following code path:

    ExcelApp.COMAddins.Item(strMyComAddinProgId).Object.MyPublicPropertyOrMethod.
     
    1. strMyComAddinProgId - the ProgId of your add-in.
    2. MyPublicPropertyOrMethod is called via late binding (see System.Type.InvokeMember in MSDN)

    Late binding allows communicating to your add-in without the need to reference it.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Friday, April 1, 2011 7:13 AM

All replies

  • Hi Koti.in,

    Thanks for posting in the MSDN Forum.

    It’s based on my experience we’re not able to access add-in’s properties or methods in the Excel Template solution. I suggest you wrap your business methods or properties in a COM component. And share it between your add-in and template solution. This is a blog to show your how to create a COM component via C# http://blog.stevedoria.net/20051008/creating-com-components-using-visual-csharp-dot-net .

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 1, 2011 6:29 AM
    Moderator
  • Hello,

    You can access your COM add-in via the following code path:

    ExcelApp.COMAddins.Item(strMyComAddinProgId).Object.MyPublicPropertyOrMethod.
     
    1. strMyComAddinProgId - the ProgId of your add-in.
    2. MyPublicPropertyOrMethod is called via late binding (see System.Type.InvokeMember in MSDN)

    Late binding allows communicating to your add-in without the need to reference it.


    Regards from Belarus (GMT + 2),

    Andrei Smolin
    Add-in Express Team Leader
    Friday, April 1, 2011 7:13 AM