📄️ Async Macro Example
We define a function that schedules a macro call to update the format of the calling range.
📄️ Building Excel-DNA From Source
To build Excel-DNA from source, create a single directory first.
📄️ Checking and Downloading Updates in .NET
Following is a simple method to check for available updates of Add-ins/Programs:
📄️ COM Server Support
Functions and macros created in an Excel-DNA add-in can be called directly from Excel VBA by using Application.Run(...). However, .NET also supports creating rich object models that are exported as COM libraries, which can be Tools->Referenced in VBA. Excel-DNA has some advanced support to host COM-exported objects from Excel-DNA add-ins, giving some advantages over the regular .NET ‘Register for COM interop’ hosting approach:
📄️ Configuring NLog Logging
This is a guide to setting up logging from within your Excel-DNA add-in, using the NLog library. I used Visual Studio 2012 and C# to put together the example, but nothing here should be specific to the particular versions or language used.
📄️ Detecting Excel Shutdown and AutoClose
This is a short note on the IExcelAddIn.AutoClose() callback, noting that it is not called when Excel is shut down, and explaining how the implementation came about.
📄️ Dynamic Delegate Registration
In come cases one might want to implement some kind of function wrapper or transformation at runtime. E.g. automatically wrapping and registering async Task / Rx functions.
📄️ FSharp Type Inference
When creating UDFs with F#, the flexible type inference might lead to function signatures that are not supported by Excel-DNA, or lead to unexpected results.
📄️ Performing Asynchronous Work
It is important to only communicate with Excel when it is Ready. For example, if one displays a non modal dialog then the program may fail if it attempts to call a VBA routine in response to a button press while the user is also in the process of editing a cell. Intercepting Window Messages messages etc. can also produce errors even though they are on the main thread. And of course accessing Excel from a different thread is forbidden.
📄️ Reactive Extensions for Excel
Excel-DNA has support for integrating the Reactive Extensions library (Rx) with Excel via RTD.
📄️ User Settings and the .xll.config File
NOTE: The details below are applicable only to add-ins targeting .NET Framework 4.x. With .NET 6, the XML-based config files are no longer automatically loaded. Additionally, the System.Configuration.ConfigurationManager has limited backward compatibility. It is recommended to use Microsoft.Extensions.Configuration and related libraries to use AppSettings.json or XML-based configuration files.
📄️ Utilising CustomXMLParts in Excel Workbooks
After struggling with the limitations of custom docproperties (being generally much too short), I decided to focus on a technology that was introduced with Office 2007: