Excel-DNA Add-ins

link - docs.excel-dna.net
The name Excel-DNA stands for "Excel DotNet for Applications".
This is an open source project that lets you create native (.xll) add-ins for Excel using C#, VB.Net or F#.
The Excel C API (introduced in 1995) is not directly accessible from .NET code.
The Excel-DNA runtime allows managed assemblies to integrate with this low-level Windows API.
Excel-DNA lets you create high performance user-defined functions and requires no installation or registration.
Allowing a user to install and run on a machine without admin access can be extremely useful.


User Defined Functions

Also known as Custom Functions
There are three different types of User Defined Functions you can create:


Synchronous - Not Thread Safe or Thread Safe
A function that is not thread safe will lock the Excel session and will only use ONE calculation thread.
A function that is thread safe will lock the Excel session and can use ALL the available calculation threads.


Asynchronous - Not Thread Safe or Thread Safe
A function that is not thread safe will lock the Excel session and can use ALL the available calculation threads.
A function that is thread safe will lock the Excel session and can use ALL the available calculation threads.


RTD Functions
These are Real Time Data functions that update automatically.
An RTD function doesn't have to keep updating Excel, it can just notify Excel once, when the calculation is complete.
link - learn.microsoft.com/en-us/office/vba/excel/concepts/excel-performance/excel-performance-and-limit-improvements


Versions

Nuget and GitHub Version History

VersionRelease Date / Notes
1.5.02021 October
1.1.12020 June
1.0.02019 April
0.34.62017 June
0.33.92015 September
0.32.02014 March
0.30.02012 December
Added support for creating async and IObservable-based real-time data functions.
Added ExcelAsyncUtil.Run
Added ExcelAsyncUtil.Observe
This version was uploaded to NuGet
0.29.02011 May
Custom Task Panes can be created
0.21.02010 January
0.18.02008 December
Support for multi-threaded recalculation in Excel 2007
0.11.02007 March
0.1.02007 January
Google group "exceldna" was created

Links

link - excel-dna.net/blog/ 
link - nuget.org/packages/Excel-Dna
link - nuget.org/packages/ExcelDna.Integration/
link - github.com/Excel-DNA/Samples
link - github.com/Excel-DNA/ExcelDna
link - groups.google.com/g/exceldna
link - youtube.com/watch?v=UEIO2Q8HyD8
link - youtube.com/watch?v=0-Rb0StiJgM
link - bitbucket.org/andysprague44/excel-dna-examples/src/master/

ExcelDna.Integration.ExcelIntegration 
ExcelDna.Integration.ExcelFunction
ExcelDna.Integration.XlCall
ExcelDna.Integration.ExcelError (enumeration)

Excel C API

The Excel C API is documented in the Excel XLL Software Development Kit, available from Microsoft here:
link - http://msdn.microsoft.com/en-us/library/office/bb687883.aspx
link - docs.excel-dna.net/excel-c-api/
Direct access to the C API is provided by Excel-DNA via two classes:


ExcelReference

ExcelDna.Integration.ExcelReference 

The ExcelReference class is a thin wrapper around the C API sheet reference information, and refers to a region (or multiple regions) on a specific sheet.
ExcelReference has helper methods to get and set the values in the region, but for additional information, specific C API calls must be made.
Using C API calls it is possible to get the address of an ExcelReference - calling XlCall.Excel(XlCall.xlfReftext, myReference, true) - and from there a COM Range object may be contructed.


XlCall

ExcelDna.Integration.XlCall 

Excel
xlfActiveCell
xlfCaller
xlfGetWorkspace
xlfSelection
xlcEcho
xlcFormatNumber
xlcFormulaGoto
xlcSelect
xlcWorkbookSelect
xlSheetNm



Other Objects



ExcelDna.Integration.IExcelAddIn 

ExcelDna.Integration.DnaLibrary 
ExcelDna.Integration.ExcelArgument
ExcelDna.Integration.ExcelArgumentAttribute
ExcelDna.Integration.ExcelAsyncHandle


ExcelDna.Integration.ExcelComAddIn 
ExcelDna.Integration.ExcelComAddInHelper
ExcelDna.Integration.ExcelCommandAttribute

ExcelDna.Integration.ExcelDnaUtil 
ExcelDna.Integration.ExcelDnaUtil.WindowHandle

Application - the correct Application root object
ExcelLimits
ExcelVersion
MainManagedThreadId
SupportsDynamicArrays
XllPath
XllPathInfo


ExcelDna.Integration.ExcelEmpty 

ExcelDna.Integration.ExcelError 

ExcelErrorNA


ExcelDna.Integration.ExcelErrorUtil 

ExcelDna.Integration.ExcelFunctionAttribute 

Description = ""
Name = ""
IsMacroType = false


ExcelDna.Integration.ExcelIntegration 

RegisterUnhandledExceptionHandler


ExcelDna.Integration.ExcelLimits 
ExcelDna.Integration.ExcelMissing
ExcelDna.Integration.ExcelReference
ExcelDna.Integration.ExcelSynchronizationContext
ExcelDna.Integration.ExternalLibrary
ExcelDna.Integration.IExcelObservable
ExcelDna.Integration.IExcelObserver
ExcelDna.Integration.Image
ExcelDna.Integration.Integration
ExcelDna.Integration.Project
ExcelDna.Integration.Reference
ExcelDna.Integration.SourceItem

ExcelDna.Integration.XlCallException 
ExcelDna.Integration.XlLibrary

public static object MyFunction(string code) 
{
  if (ExcelDnaUtil.IsInFunctionWizard() == true)
   {
    return "Uncalculated";
   }

   var results = method_ReturnTheValue();

   return results ?? ExcelDna.Integration.ExcelEmpty.Value;
}


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