PowerPoint as a code — Reusing slides in multiple presentations


When you work on slides for public talks it may happen that you would like to have two similar talks sharing some slides. For instance, one of my talks explains internals of async in C# so I have plenty slides with decompiled code, documentation etc. But my other talk, covering cons of async, has similar part as it also needs to explain some machinery before moving forward. However, I’d like to avoid just copying slides here and there as updating them is much harder. So I’d like to be able to extract common parts and reuse them.

I don’t want to use TeX to do so. I made presentations in TeX and I find it very tedious and time consuming, not to mention that ad-hoc adjustments for events (like theme or first slide) are much harder without proper software in place (or even with it, it’s still TeX). PowerPoint is simple and powerful enough for my needs so I wanted to use it. So I implemented couple of VBA functions to do the job.

So I prepared a PowerPoint deck with macro which merges all building blocks together and I can easily modify the macro to add, remove, reorder, or change slides on the go. Simple enough.

Presentation content

All my talks have similar blocks and use the same theme. I use:

  • Section name
  • Some content
  • About me
  • Agenda
  • Presentation title, Q&A, Thanks

So there is not many building blocks to be used. Let’s go.


Press ALT+F11 and add new module to the presentation, save the file as macro-enabled deck. Now, you can run macros easily with ALT+F8.

First function we need is one to remove all slides and sections from the deck:

We call this method once at the beginning.

At the end we need to set the footer with slide numbers, date, and a title:

And we need to set title in metadata:

Section name

The simplest slide with just a section name and a subtitle:

We add slide with specific layout and then update labels.

Some content

Here comes the reusability. We prepare separate deck with any slides we like (the actual “content” of the talk) and then copy them over here:

You can see how I take the current presentation path, go to Fragments directory and the get specific file. Slides are added at the end. Also, section is created before added slides so it is easy to identify where they come from.

About me

This is basically a single slide just like fragment, however, it is probably exactly the same in all talks so I just store it once and reuse:


Now we want to generate a slide with bulleted list. Since agenda will change for each talk (depending on the content), we’d like to generate it automatically:

I accept a list of labels and indent them respectively. I call this method like this:

You can see that I insert 3 spaces to indent the label. Obviously, you can extend this as you wish.

Presentation title, Q&A, Thanks

These are almost regular section name slides but they have QR code on them which is added like this:

It copies the picture and puts it directly into the slide.

Now it gets super simple. Q&A:

Presentation title:


Merging things together

All helper methods are private. Now we need to actually define one macro which will compose everything together:

I start with defining variables which I’ll use later. I remove all slides. Next, I set settings like common talk name and path to the QR code.
Then goes the table of content. You can see I start with building blocks used together.
Finally, I set the footer on each slide, and update the metadata.

If I now want to add, remove, reorder, or change slides — I simply modify them here in this method. Obviously, actual content needs to be changed in the files stored as fragments. Good thing is it is stored in exactly one place. Recreating slide deck takes around 5 seconds for this table of content so it is good enough for my purposes.