C# Excel Add-ins


TypeDescription
VSTO(Added in 2007). Must implement the IStartup interface.
Excel-DNA(Backwards compatible with 1997)
Automation(Added in 2002). Must implement the IDispatch interface. Implementing the IDTExtensibility2 interface is optional.
COM(Added in 2000). Must implement the IDTExtensibility2 interface.
XLA(Added in 1997). This is a workbook that is saved with the XLA file extension. Uses the Excel Automation object model, all the code is interpreted so slower than an XLL.
XLLs(Added in 1995). The add-in is written in C and uses an Excel C API which is compiled into a DLL and renamed with a XLL file extension.

Registry Switches

/RRead Only
/FDemand Loaded
/A Automation Add-ins

Note that if your Add-in is a Shared Add-In which does not use a COM Shim then you will need to check if mscoree.dll is listed in the "Disabled Items" list. If you find that your Add-In component is listed in the list, enable it and retry.


In general it is not recommended to mix VBA with managed code mainly due to the non-deterministic eventing model. In other words if VBA and managed code are listening for the same event there is no guarantee of the order that the handlers will be called.
Another issue with using VBA and VSTO in the same solution is that you now have to deal with two separate security models. With that said, there are still times when you want to call VSTO code from VBA








© 2018 Better Solutions Limited. All Rights Reserved. © 2018 Better Solutions Limited TopPrevNext