Entry point for non UDF use

Jul 19, 2012 at 2:02 PM
Edited Jul 19, 2012 at 2:25 PM

 

Very much like what I see so far of DNA, especially the slick deployment side.

However, I'm not interested too much in the UDF side at the moment. I'm interested in building a command bar [with buttons ect] on either an addin load  or workbook open event, and then carrying out certain things on a workbook open event and sheet [cell] change event. However, not sure how I get a handle on the application object or what the entry point is through an ExcelDna.Integration object handle ? e.g. with a COM add-in you'd get at the application via IDTExtensibility2 and pass it to a control shim  [that sets up the event handlers etc] with something like:

public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom) {

   _excelAppHandle = (Application)application;           

_excelShim = new ExcelShim(_excelAppHandle);

 addInInstance = addInInst; }

Coordinator
Jul 19, 2012 at 8:22 PM
Edited Jul 19, 2012 at 8:23 PM

You can get hold of the right Application instance by calling ExcelDnaUtil.Application.

From there you can hook up the CommandBars and event handlers.

One place you can set things up is by defining a class that implements the ExcelDna.Integration.IExcelAddIn interface, which has an AutoOpen() method that will be called when your add-in is loaded.

-Govert