I want to initialize a couple of variables on Excel Dna .dll gets loaded in the Excel?
Excel-DNA will check whether your add has a public class that implements the interface ExcelDna.Integration.IExcelAddIn
, and if so will run the AutoOpen method when the add-in is loaded, and the AutoClose method if the user removes the add-in from the add-ins list.
So you'd have something like:
public class MyAddIn : IExcelAddIn
{
public void AutoOpen()
{
// Do your initialization here...
}
public void AutoClose()
{
}
}