I successfully got all of my functionality to work in VSTO with automation. I am also investigating the XLL approach.
In VSTO, when I add a ribbon it appears under the Add-Ins menu in Excel. I attempted to use the sample where the ribbon was created in the .dna file for the project but do not see it under the Add-In menu. Where does this menu appear?
The contents of my .dna file are provided below.
<DnaLibrary Name="ExcelXLL Add-In" RuntimeVersion="v4.0">
<ExternalLibrary Path="ExcelXLL.dll" LoadFromBytes="true" Pack="true" />
<Reference AssemblyPath="System.Windows.Forms.dll" />
<!--
The RuntimeVersion attribute above allows two settings:
* RuntimeVersion="v2.0" - for .NET 2.0, 3.0 and 3.5
* RuntimeVersion="v4.0" - for .NET 4 and 4.5
Additional referenced assemblies can be specified by adding 'Reference' tags.
These libraries will not be examined and registered with Excel as add-in libraries,
but will be packed into the -packed.xll file and loaded at runtime as needed.
For example:
<Reference Path="Another.Library.dll" Pack="true" />
Excel-DNA also allows the xml for ribbon UI extensions to be specified in the .dna file.
-->
<![CDATA[
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ExcelDna.Integration.CustomUI;
[ComVisible(true)]
public class MyRibbon : ExcelRibbon
{
public void OnButtonPressed(IRibbonControl control)
{
MessageBox.Show("Hello from control " + control.Id);
}
public static void ShowHelloMessage()
{
MessageBox.Show("Hello from 'ShowHelloMessage'.");
}
}
public static class MyFunctions
{
public static string TestFunction()
{
return "Testing...OK";
}
]]>
<CustomUI>
<!-- Inside here is the exact RibbonX xml passed to Excel -->
<!-- This will only be loaded for Excel 2010 because of the namespace -->
<ribbon>
<tabs>
<tab id='CustomTab' label='XLL POC Ribbon'>
<group id='SampleGroup' label='My Sample Group'>
<button id='btnXLLPOCRibbon' label='XLL POC' onAction='RunTagMacro' tag='ShowHelloMessage' />
</group >
</tab>
</tabs>
</ribbon>
</customUI>
</CustomUI>
</DnaLibrary>