Any events supported in ExcelDna?
Asked Answered
A

1

5

I want to initialize a couple of variables on Excel Dna .dll gets loaded in the Excel?

Adolescent answered 27/6, 2012 at 19:38 Comment(0)
T
8

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()
    {
    }
}
Tyrosine answered 27/6, 2012 at 23:2 Comment(2)
Govert; Thanks for Update. This is certainly helpful. As I more look into ExcelDNA i am more enthused about that. I am planning to develop full fledge Add In which will have excel functions (i.e. UDF), custom task pane and custom ribbon. I will do all my coding in C# .dll; I do not want to rely on .dna file; i will just ExternalLibrary Tag in .dna file. Can I put all of these features in one .dll ? As of now I have I have ExcelFunction (i.e. UDF) within static class which is working fine. Thanks for your help in advance...Adolescent
You can do all of that in a single C# .dll, then pack everything into a single .xll file to give to your users.Tyrosine

© 2022 - 2024 — McMap. All rights reserved.