VBA VS. VSTO what is the difference, should I upgrade? VBA VS. VSTO what is the difference, should I upgrade? vba vba

VBA VS. VSTO what is the difference, should I upgrade?


Which toolset you use is largely a matter of personal preference, but here are some things to consider:
1. Performance: For most Excel-related tasks VSTO performs very slowly compared to VBA because of the additional Interop layer.
2. UDFs: VSTO does not support UDFs
3. Object Model: Its harder to work with the Excel object model with VSTO than with VBA because there is no .NET Macro recorder to give you hints.
4. IDE: With VSTO you get access to the latest Visual Studio IDE (assuming you have a Visual Studio license)
5. .Net Framework: VSTO gives you access to the very rich and powerful .NET framework
6. Learning curve: VB.NET is a different language to VBA and the .NET framework and object model differences mean that the transition is not as simple as it could be.
7. If you want to go the visual studio/.NET route I would recommend you look at Addin Express or XLDNA rather than VSTO: both of these have less limitations than VSTO


VBA in Excel gives you the advantage of having fast results between editing your code and running your code. Because you are a good VBA programmer, you could live without the super feature from Visual Studio (intellisense, try-catch-fanally, inherits, every .NET objects, multi-threading ...)

VSTO is a way to work inside a very good IDE (Visual Studio), but i am afraid you will waste a lot of time switching between VB.NET and your Excel. It is not as direct as your VBA inside your Excel.

If your main purpose of programming is to stay inside your Excel file, then stay with VBA. If you really need to work outside your excel file or if you want to do something that doesn't necessary depend on your excel files, maybe you could consider VSTO. Beside, VSTO is pretty new and documentation may not be complete.

I would stay with VBA if I were you. THIS IS MY HUMBLE OPINION.I wrote a little comparative between VBA and VB.NET (VSTO): Here's Difference between VB.NET and VBA!


This is 6 years after this question was originally asked so it's possible that at the time of the OP a comparison between these two tools were different, but I am actually very surprised at how favorable the existing answers are towards VBA!

VBA is interpreted and housed entirely within the application. The advantages here are:

  • Coding can be done directly within the application, requiring no external tools
  • Application-specific features like Macro recording can enable quick prototyping
  • You can leverage Excel-specific ActiveX controls like RefEdit
  • UDFs can be developed easily
  • AddIns are distributed as documents (.xla format)

For small applications and UDFs VBA works fine. You can build quickly and easily in Excel and things "just work."

If your program has any type of complexity however, it would be very worthwhile to explore VSTO. Advantages there include:

  • Ability to use multi-paradigm programming languages like VB.NET or C#
  • Better collection support (generic lists, dictionaries, tuples, etc...)
  • Support for threads, asynchronous execution
  • Deployment of AddIns as standalone applications
  • Ability to use native WinForms and develop non-blocking UIs

VSTO is at this point is pretty well documented:

https://docs.microsoft.com/en-us/visualstudio/vsto/create-vsto-add-ins-for-office-by-using-visual-studio

The topic of performance is rather vague but to contrast some of the previous answers this really depends on your bottlenecks. COM interoperability may add overhead, but at the same time the VBA execution model is much slower than what can be offered by C#. Particularly when you take into account the various paradigms that programming a VSTO can offer three are applications where a VSTO will be orders of magnitude faster than a similarly coded VBA program.