I am using excel-dna as base function, then I call a "vsto" function from an addin to trigger a web service request on the selected function. My issue is that I d like to use the DNA function to parse the ranges to be send to the service. It return a string currently ("waiting for service call..."), and if the VSTO methods call the function it passed another variable to return something else.
I cannot extract other thing than string, object comes back empty when I use "evaluate" in vsto.
I think the best way would be to reach a global cache variable stored in the vsto addin from the excel-dna function. I could not manage to to this.
Addins button push => addins evaluate Excel DNA => DNA store data in VSTO Addin variable => VSTO call the service and paste the returning data.
Thank you,
Ok I found out on: MSN Blog
namespace AddIn{
[ComVisible(true)]
[Guid("****************************")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IAddinUtilities
{ void youraddinfunction();
}
[ClassInterface(ClassInterfaceType.None)]
public partial class ThisAddIn : IAddinUtilities
{
protected override object RequestComAddInAutomationService()
{ return this; }
public void yourfunction (){ DoSomething }
}
In the excel Dna function :
var application = (Application)XL.ExcelDnaUtil.Application;
var addin = application.COMAddIns.Item(AddinName);
var what = addin.Object;
what.youraddinfunction;