CALL UDF's IN Custom Ribbon

Jun 6, 2012 at 11:58 AM
Edited Jun 6, 2012 at 3:35 PM

Hi guys, i'm a just start working with Excel-dna, and it is awesome, real pratice in the creation of UDF's.

My problem is this ,I successfully created UDF's and a Custom Ribbon with the samples in the Distribution package. but now i want to create , the same ribbon/udf's in external class, just like:

-> addin.xll

-> addin.dna

-> udf's_ribbon.cs

 

I want "create" and  the UDF's in the "*.cs" and not in the "*.dna" file like in the sample.

Like this:

->*.cs = UDF's

->*.dna = ribbon xml

it is possible to do this? can anyone help me?

 

EDIT: This problem is solved

Jun 6, 2012 at 2:33 PM
Edited Jun 6, 2012 at 4:07 PM

New problem, how i can call my UDF when e click a button of ribbon?

 

SOLVED Again

 

-> using Excel = Microsoft.Office.Interop.Excel;

(...)

            Excel.Application app = (Excel.Application)ExcelDna.Integration.ExcelDnaUtil.Application; 

            Excel.Range activeCell = app.ActiveCell;           

    string origFormula = "=TestFunction()";           

            activeCell.Formula = origFormula;         

            activeCell.FunctionWizard();