1

I'd like to create an Excel Add In. But I want it to have a special behavior.

Then problem is that the Excel Add In I developed stays within Excel. Even when I run a normal Excel instance from Windows...

So what I want, to be more precise, is to have an Excel add in that will only appear in the Excel's ribbon when launched by my own C#_made application.

How should I do that ?

The behavior would be :

  • Run my C# application
  • My C# application calls a new Excel's instance
  • My C# application adds a new tab (and its elements) to the ribbon of this Excel's instance
  • My C# application adds actions binded to the tab's elements
  • Excel's instance is being closed > Remove all added components, functions, methods, ...
  • Close my C# appliclation
1
  • Look around in the Excel.Application for some way of toggling currently active add-ins. Since there is something like that in the actual application, I'm assuming there's something like the same in the C# interop. I'll help you more later if you haven't solved it, currently in a rush.. :) Good luck! Commented Jan 20, 2012 at 8:36

2 Answers 2

1

Here's a nice tutorial for you: http://www.add-in-express.com/free-addins/net-excel-addin.php

Edit:

Have you considered just disabling the addin, then reenabling it whenever you launch the app with a server that runs in the background and when excel is closed, disables the addin?

Here's some unload code I found here:

private void UnloadBadAddins(bool unloadAddin)
{
    const string badAddin = "iManage Excel2000 integration (Ver 1.3)";

    foreach(Office.COMAddIn addin in this.ExcelApp.COMAddIns)
    {
        if (addin.Description.ToUpper().Contains(badAddin.ToUpper()))
        {
            if (addin.Connect == unloadAddin)
            {
                addin.Connect = !unloadAddin;
                return;
            }
        }
    }
}
Sign up to request clarification or add additional context in comments.

3 Comments

I don't think you properly read his question. He's asking how to enable a specific functionality in Excel through interop, not how to create/use addins in general.
Edited to better answer question. :)
It worked great ! That's exactly what I wanted ! Thank you both !
1

I have found the following two properties on the Microsoft.Office.Interop.Excel.Application class:

var excel = new Application();
excel.AddIns
excel.AddIns2

Maybe these can help you programmatically add/remove addins during your application run?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.