1. Home
  2. MS Office

How to run VBA code in Office 365 apps

Office 365 apps are quite capable. They’ve been years in the making so you will find that they have any and all features that an average or even advanced user might need. That said, there are still enough unique use cases where the built-in feature still falls short. In many of these cases, you have to use macros or VBA code to get the job done. If you’ve never run VBA code in Office 365 apps, you might be a little confused as to how it works. It’s fairly simple so long as you have the code that you want to run.

Run VBA code in Office 365

The process for running VBA code in Office 365 apps is similar. We’re going to explain how it works in Word but it will work more or less the same in all other apps that allow you to run VBA code.

Open Word and go to File>Options. On the Options window, select the ‘Customize Ribbon’ tab. You will see two columns on this tab. In the column on the right, look for the ‘Developer’ tab and make sure the box next to it is checked. If it isn’t, check it.

Return to Word’s main interface and go to the Developer tab on the ribbon. Here, you’ll see a button called Visual Basic. Click it.

Another window will open and the window is going to look as though you’ve opened a new app. On this new window, go to Insert>Module. This will insert a new box within the Visual Basic window. Paste the VBA code in this window.

Once you’ve pasted the code, you can run it and it will run on the app that you have open e.g. if you have Word open, the code will run for the Word file and execute whatever action it is meant to execute. To run the code, click the green play button.

Writing VBA code isn’t exactly something everyone knows. It’s not the most complicated thing to learn but if you don’t know how to run VBA code in Office 365, chances are you may not know much about writing it as well. In that case, you should only run code that you know has been written by a trustworthy source. If there are errors in the code, it may not run and it will be up to you to troubleshoot it.

The code may take time to run, or it may finish within seconds. It all depends on the size of the file, and the complexity of the code that is being run.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.