Hello VBA users (actually, it’s okay if you have any programming language experience). In this series of articles, I will demonstrate the full development cycle of Excel Web Add-in as an alternative of VBA, from the project creation to the public publish of add-ins. If you are a long-time VBA user, I guess you are curious and frustrated by MS’s decision to promoting Excel Web Add-in (utilizing JavaScript) and discoursing using VBA. I will guide you through how Web Add-in development looks like in parallel to VBA.
I was a computer programmer mostly using C++ and Java. Now I am teaching at a university as a finance and real estate professor. I use R a lot. I am teaching financial modeling using VBA. I had to learn VBA. It was quick with my prior background. Now, I am using VBA for some finance projects. Despite some downside of VBA (especially security issues), it is true that VBA is very easy to learn and very efficient development tool for Excel. Sadly, to VBA community, MS is promoting JavaScript based Excel Web Add-in to replace VBA.
Before I start this series, this is my verdict so far after I tried out Excel Web Add-in development.
- Base language It uses JavaScript. Syntax is very easy to learn. If you are a VBA user (or have used any programming languages), I am sure you can learn the basic grammar in an hour. Just go through this JavaScript tutorial (https://www.w3schools.com/js/). Of course knowing grammar does not necessarily mean that you can code complicated logic right away. However, you can start simple stuff fairly easy.
- API (or Object) VBA provides many functions and objects, such as Range, Sheet, Workbook, etc. JavaScript is also OOP and provides similar objects and they contain similar properties and methods. VBA has tons of objects, properties and methods. If you use VBA, you can easily figure out how to use objects by using Macro Recorder. Unfortunately, Web Add-in does not have that kind of recorder. So, if you are familiar with VBA already, then at least you can use good guesses to find out objects, properties and methods. If you are a totally new programmer, you have to fully understand the API documents. By the way, online version of Excel has Automate function which record macro in Office Script (this is a superset of JavaScript, just very similar one) for Microsoft 365 business subscribers. This is not a Web Add-in and they are different that I am going to explain later. MS created one more complexity as a result.
- Development Environment (IDE) Developing with VBA is straight forward with Excel’s built in IDE (F11 short-cut key), even if it has ancient look, However, for Web Add-in, you have at least 4 options to choose (Visual Studio Community, Visual Studio Code, JADE, & Script Lab). Wow, already things are getting complicated. I try them out and personally chose and recommend the most recent version of Visual Studio Community (it’s free).
- More in Development Excel Web Add-in uses JavaScript which is meant for website development. So, you also need to know at least basic of web (html) programming.
- Deployment (publish) Now, if you finished your code development, it’s time to deploy to some else.
- VBA: save xlsm and send the file. It’s so simple (at the same time this causes security issues)
- Excel Web Add-in: First, you have to host your program on the application server. Then you have to publish your program’s manifest file (kind of instruction of your program such as where it is located, what is the name etc.) to Excel App store or your company’s some kind of server. If you don’t know any of these, that’s fine. I will explain later. Even if I was a programmer, web programming and application server, etc. were never my area and I had to learn only to try out Web Add-in. Actually, it took a lot more time to figure out this publication process than to know how to code in JavaScript. At this moment, I could publish my example add-in to a application server. I am trying to distribute it on Excel App Store but MS is not approving me as a valid business entity. I will update if I succeed to make their valid business partner.
Sounds complicated already? I think so. The Web Add-in documents are not that robust yet and it is difficult to do develop Excel Web Add-in. Some of the MS’s tutorial say “it’s simple”, “it’s easy” but I do not agree. VBA is meant for advanced Excel users while this Excel Web Add-in is developed in the viewpoint of engineers. That online Excel’s Office Script is easier (close to VBA) but it is not a perfect replacement for VBA either. So, then Excel Web Add-in is not worthwhile to know? It depends. It actually has great potential that once you develop it, it runs everywhere (Windows, Mac, smart phones and Browers). So, you can easily move your business logic to cloud. I don’t believe MS can totally remove VBA from Excel due to existing legacy programs (of course they will not improve it though). So, in the meantime, you can continue using VBA. I hope you can just consider or be prepared for Web Add-in development reading this series.