Excel C# Interop vs. Excel VBA

By | February 12, 2018

I am in charge of finding bottlenecks in a Excel Add-in. Some of the workbooks calculate extremely slowly. I have the experience of working with VBA code, and the older versions of our product used all VBA code to execute calculations. However, in the newer versions of the product, a lot of the calculations are being done through the add-in, which is build on top of ASP.NET C# using Excel.Interop libraries. My question is this: Do interop libraries just run slower then code that resides directly in a workbook in the VBA? From my experience, all projects using Excel.Interop run extremely slow on intense calculations. If so, does anyone have any advice on speeding up Excel.Interop processes and functions?



Interop has a significantly higher overhead than VBA for object model calls and data transfer calls. Its worth working hard to minimise the number of calls.
You may want to look at my blog post comparing Excel UDF technologies:
UDF Technology Choices

If you are able to use Addin-Express or Excel DNA I would recommend both products.

For general advice on optimising calculation speed I recommend my website
or my MSDN white papers .

Leave a Reply

Your email address will not be published. Required fields are marked *