Excel Interop


What is COM Interop ?

This is a term that is used to describe backwards compatibility between COM and .NET.
Components written with COM technology are able to use assemblies written with .NET technology. And assemblies written with .NET technology are able to use COM components.
This is all possible without changing the actual components.
Interoperating between .NET and COM is made possible thanks to two wrappers.
COM Callable Wrapper - Allows a COM component to access a .NET component. For example VBA calling C#.
Runtime Callable Wrapper - Allows a .NET component to access a COM component. For example C# calling VBA.
https://www.simple-talk.com/dotnet/visual-studio/build-and-deploy-a-.net-com-assembly/



Type Library Registration

HKCR/TypeLib/{---}
HKLM/Software/Classes/Interfaces/{---}/TypeLib/Default - {--}
HKLM/Software/Classes/TypeLib/{---}



Application.RegisteredFunctions

Returns an array of all DLL functions that are registered within Excel.



Application.RegisterXLL(filename)

Loads an Excel DLL (xll) and registers it



Application.RTD

Returns a real time data object


Different Types of Add-ins

There are several different types of add-ins that can be created using Visual Studio.



VSTO add-ins load after all the other types of add-ins have loaded first.


You can easily distinguish between COM add-ins and VSTO add-ins in the registry because of the location information.
COM add-ins point to the DLL file
VSTO add-ins point to the .vsto file


Important

There is no deployment option that enables end users to use the COM Add-ins dialog box to install an add-in that has been created using VSTO.


© 2017 Better Solutions Limited. All Rights Reserved. © 2017 Better Solutions Limited

Next