How to use macros in PowerPoint 2016 and 2019 slides?

Here’s a question we got from a reader:

I have a need to automatically resize all images stored in a specific presentation I have to prepare for my management. As the slides are quite standard, this looks like something I could automate using a Macro. The thing is that I don’t find the macro recorder button in the Powerpoint development tab. Can you help?

Yes sure! There are many tasks that could use quite a bit of automation in PowerPoint such us:

  • Auto-creating periodical presentations (say quarter reports).
  • Auto-formatting your PowerPoint slides – applying styles, fonts.
  • Working with images
  • And more…

You are right in your assertion about the fact that Microsoft PowerPoint doesn’t allow you to record a macro; so you’ll need to create one manually using Visual Basic for applications (VBA). It’s quite simple just follow on.

Create a macro enabled presentation

First off,  let us create a backup of  your original presentation, so you can always come back to it if needed:

Open the specific presentation that you want to automate.

Save your presentation using a different file name, say MyPresentationMacro, and make sure to pick the file format .pptm (Powerpoint Macro presentatio) as your file type.

Then, if you don’t see the developer button in your Ribbon, you should go ahead and enable it.

Inserting your Macro to PowerPoint

Your next step would be to insert your VBA code snippet into a Visual Basic for Applications Project Module. Follow the instructions below:

  1. From the Ribbon, hit Developer
  2. Then hit the Visual Basic button
  3. The VBA editor will open up.
  4. Now, from the project tree, highlight the VBAProject entry.
  5. Now from the header menu hit Insert and select Module.
  6. At this point you can paste your macro. A word of caution here: Always ensure that you obtain your macro from reliable resources. Copying VBA code from the web is not a good idea!
  7. Now, hit Debug and then then select Compile VBA project.
  8. If you receive no error messages, go ahead and hit Save.

Running your Macro

  1. Close the VBA editor and return to your Powerpoint presentation.
  2. Back to your developer tab, hit Macros.
  3. Pick the Macro that you have just added to your presentation in the previous section.
  4. Hit Run.

Note: Your Microsoft Office installation might have VBA Macros disabled by default. If that’s the case, from the Developer ta, hit Macro Security and select Disable all Macros except digitally signed.

Assign a button to your Macro

If you would like to improve the usability of your VBA Macro, you can easily assign it to a button.

Leave a Comment: