M4V3R1CK
M4V3R1CK

Reputation: 771

Excel C# Interop vs. Excel VBA

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?

Thanks.

Upvotes: 3

Views: 1698

Answers (1)

Charles Williams
Charles Williams

Reputation: 23530

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 .

Upvotes: 4

Related Questions