Tuesday, November 11, 2008

ExcelDNA

ExcelDNA (via hubFS) allows custom Excel functions to be written in .NET with zero deployment effort. In F#, it's as simple as defining a library file of annotated functions, wrapping it in some XML .dna file (where $SCRIPT is replaced by the content of the actual F# script), and copying the ExcelDNA.xll to give it the same name as your .dna file. Then, double-clicking on the .xll file opens up Excel augmented with the custom functions. It's excellent.

Monday, November 10, 2008

Visual Studio Tools for Office

Visual Studio Tools for Office (VSTO) is the official buzzword for programming Office, including Excel, in .NET. Now, I know what to Google for! Good starting points for programmers (not accountants!) include the MSDN library page for Visual Studio Tools for Office and the book Visual Studio Tools for Office: Using C# with Excel, Word, Outlook, and InfoPath (Microsoft .NET Development Series). This book, co-authored by no less than Eric Lippert, is geared towards professional software developers unlike the plethora of VBA books. Unfortunately, I cannot get the Excel AddIn sample to work as described in the book with Visual Studio 2008 and Excel 2007.

Setup for .NET and F# programming of Excel

  • Setup MS Office 2007, Visual Studio 2008 and F# as necessary.
  • Download and install the Office Interop Assemblies.
  • Try out this test F# script, which opens Excel, creates a new workbook and fills in the first sheet with the table of squares from 1 to 12.

What are the options for programming Excel?

I asked the question over at StackOverflow.