how to create a ribbon

Feb 5, 2010 at 3:19 AM

I am using exceldna to build an excel addin. I have created a class library project in visual studio 2008. I compile it into a dll file. I use an xll file to add the addin into excel. The xll file calls the dna file and then it calls the dll file to execute the program. Now I want to add a ribbon to excel. I just know that I can create an addin project in visual studio 2008 to create a com addin, but when I want to get the excel object from the com addin, i.e. 

Microsoft.Office.Interop.Excel oExcel = (Microsoft.Office.Interop.Excel.Application)ExcelDnaUtil.Application;

It returns this error "Exception of type 'ExcelDna.Integration.XlCallException' was thrown"

Can you tell me how can I get the excel object after I click a button in the ribbon I have created. Thanks.

Feb 15, 2010 at 9:55 AM


You might need to send a small sample application to debug this. If the rest of the add-in works fine in your Excel, I'd expect the ExcelDnaUtil.Application call to be fine. Maybe you can see what the problem is by running everything in a debugger?