0
votes

I have a Visual studio project to create a .xll addin.

In that project I have a Main.cs file and a Functions.cs file.

The Functions.cs file stores the UDFs that will be used in Excel.

I had another project to create a ribbon for excel. In that project was a Ribbon.xml and Ribbon.cs file. I moved those 2 files to the .xll project.

But I have no idea what to do to so that when the user installs the .xll file to their Excel, the custom ribbon tab will show as well.

By the way, I'm a beginner and I'm doing this for an internship. So either I can't really find any discussions on this or I do not understand what people are really discussing. So I apologise in advanced for questions that may seem very simple to you.

1

1 Answers

2
votes

To add a ribbon to your Excel-DNA add-in, you need to add a public class that derives from ExcelDna.Integration.CutomUI.ExcelRibbon. When loading the add-in, Excel-DNA will find and instantiate an object of this type.

To provide the xml, you override the GetCustomUI(...) method, and other callbacks are public methods in this class.

Excel-DNA also supports putting the ribbon xml in the .dna file (that's just an alternative to implementing GetCustomUI(...)). The examples you find on GitHub use this approach as it's a bit easier when making a single file example. (The examples are here: https://github.com/Excel-DNA/ExcelDna/blob/master/Distribution/Samples/Ribbon/TestCSharp.dna)

For documentation on the xml schema and signatures of the callback functions, you can look on MSDN: http://msdn.microsoft.com/en-us/library/aa338202(office.12).aspx (3 parts)