PowerPoint is an awesome tool for creating your latest presentation template but if you’re the person responsible for creating them in your organisation, you’ll know that PowerPoint often behaves like a badly-behaved monkey. I’m going to walk you through the pitfalls of slide master layouts and show you how to manage them and recover any deleted default Office layouts using VBA. You can also check out our PowerPoint automation service.

Why are layouts in PowerPoint so important?

Layouts define how your content is consistently laid out on the slide in a way that respects your brand. Each layout uses a set of content placeholders and each placeholder, depending on its type, may contain text, pictures, video or more complex content such as tables, charts and SmartArt.

Backing up a bit, any and every presentation you create is based on a template, often deployed as a potx file, and each template contains all the slide masters and layouts used to keep your visual content on-brand.

If you only ever work with one template, then your life will be filled with smiles and sunshine. However, the monkey in PowerPoint comes to life when you work with presentations that have been built on different templates. This is very common in organisations that have issued revisions to templates either to make minor corrections and design tweaks or as a result of a more significant rebranding program.

What often happens is that the old template doesn’t contain the same number, identity or type of layouts as in the new template. Now, when you copy content from your old presentation based on the old template to your new presentation based on the new template, PowerPoint tries to work out how to reassign each slide to a layout. Sometimes it works, but more often it fails. When it fails, PowerPoint has no choice but to create a new layout or even worse in some cases, a new master with many layouts in your presentation file. But you probably won’t notice until your file size is bloated, or someone asks you why your slides are no longer on-brand.

You can see when this happens as layouts are either added with an unfamiliar name, taken from the old master, or are prefixed with a number and underscore:

PowerPoint Slide Master Layout orphan

These erroneous layouts and/or masters are often referred to as orphaned layouts and masters. An orphaned master in the above example might be named “1_Office Theme” and if multiple erroneous masters have been created “2_Office Theme”, “3_Office Theme” and so on to infinity and beyond.

If your slide master includes images, this behaviour can make your presentation files very big, no, huge, over time and more importantly, impact the consistency of your brand.

Now you might ask what criteria PowerPoint uses to map one slide’s layout to another. You might assume that it uses the name of the layout such as “Title and Content” but it’s not as simple as that unfortunately. Behind the scene, there is a lot of hidden information about a layout that you and I can’t see in PowerPoint and it must match all of the following properties before it correctly maps a layout to a slide:

  • Slide Layout Name
  • Slide Layout Type* (hidden data in the PowerPoint file)
  • Number of Placeholders
  • Types of each Placeholder e.g. title, body, footer etc.
  • Placeholder Unique Identities* called “idx” (hidden data in the XML of the PowerPoint file)

* This information is not accessible to you and if you delete placeholders or layouts from the master, you can seriously mess up your template, breaking it beyond [easy] repair.

And that’s why layouts, the creation and management of them are so important.

Assigning layouts to slides in PowerPoint

You assign a layout to a slide by going to the Home tab and clicking the Layout drop down and then clicking the most appropriate layout design for your intended slide content:

PowerPoint Home Layout selection

You can also right-click on an unoccupied area of the slide and click Layout from menu:

PowerPoint right click layout assignment

In the example above I’ve used the default Microsoft Office template and for Office 365, it includes nine default layouts. You might see eleven depending on your version of PowerPoint or more if you have a custom template.

Once a layout is assigned to a slide, it encourages the use of consistent positioning, sizing and styling of the content you populate the slide with. I say “encourage” because you can always break it and go off-brand with your creative muscle. If you do and you didn’t mean to, simply click the Home tab and click the Reset button in the Slides group or do the same with a right-click on an unoccupied area of the slide and click Reset Slide:

PowerPoint Slide Reset

All your content will be snapped back into position, size and styled according to the assigned layout.

Editing layouts in PowerPoint

You can view and edit all the layouts in the slide master by going to the View tab and click Slide Master:

PowerPoint View Slide Master

You can also hold the Shift key and click on the Normal button in the PowerPoint status bar:

PowerPoint double-click Normal View for Slide Master

Single clicking this button takes you to the layout assigned to the current slide and double clicking it takes you what’s often referred to as the slide master parent.

Once in the Slide Master view you’ll see the layouts below the slide master parent:

PowerPoint Slide Master View annotated

The parent contains the default style for the title, body, date, footer and slide number placeholders. It may also include common background pictures such as a brand logo, graphics and photography.

Importantly, all the layouts below the parent follow the style of the parent. They are linked to the parent by default, but this link can be easily broken if you do things like deleting content from the layouts.

And because each layout is referred to by PowerPoint when you copy and paste content from one presentation to another, should you delete the layout, the PowerPoint monkey will get confused and start bloating your file with orphaned layouts and/or masters. This is a dark doorway to a PowerPoint nightmare I wouldn’t wish on anyone!

Restoring deleted slide master layouts in PowerPoint

Let’s assume that someone has deleted the Title and Content layout from your template’s slide master. You might assume you can simply fix this by inserting a new layout, naming it “Title and Content” and inserting the required placeholders. Earlier, you learned that PowerPoint uses more than just the name to match slides to layouts. It’s no surprise therefore that trying to fix your template this way won’t work. So, what’s the solution?

Are you ready to delve into the world of VBA to fix your template? It’s very easy and I’ll take you step-by-step through the process next.

What is VBA?

Visual Basic for Applications is a programming environment for Microsoft Office applications. It’s included with your installation of Office by default unless your system administrator has deactivated it. VBA provides you with a way to automate PowerPoint and extend its functionality using macros and add-ins. I’m going to use it to automatically restore the missing default layouts that come with Microsoft’s default PowerPoint template.

Opening the magical door to the wizardry of VBA

Getting to meet your VBA friend is very simple. With PowerPoint open and at least one presentation file open, press Alt+F11* on your keyboard. This will open the VBE (Visual Basic Editor):

PowerPoint VBE No Modules

*If for some reason Alt+F11 isn’t mapped on your keyboard you can right click anywhere on the ribbon, select Customize the Ribbon… and in the window that appears, tick the Developer Tab check box over on the right hand side before clicking OK to close the window. Now you can click the Visual Basic button within this tab:

PowerPoint Developer Tab Visual Basic

Adding VBA code

To add some VBA code, you need a container to put it in so go ahead and click Insert from the menu and then select Module:

PowerPoint VBE Insert Module

You now have a module ready to paste the VBA code into that I’ll provide below:

PowerPoint VBE Module Inserted

Copy the VBA code from below by double-clicking on it and then paste it into the Module1 window above.

Option Explicit

'----------------------------------------------------------------------------------
' PowerPoint VBA Macro to restore any missing default Office layouts
'----------------------------------------------------------------------------------
' Copyright (c) 2019 BrightCarbon Ltd. All Rights Reserved.
' Source code is provided under Creative Commons Attribution License
' This means you must give credit for our original creation in the following form:
' "Includes code created by BrightCarbon Ltd. (brightcarbon.com)"
' Commons Deed @ http://creativecommons.org/licenses/by/3.0/
' License Legal @ http://creativecommons.org/licenses/by/3.0/legalcode
'----------------------------------------------------------------------------------
' Purpose : Rebuilds the slide master by inserting slides assigned to the default
'           Office template layouts before deleting those slides, resulting in the
'           layouts remaining intact within the slide master.
' Author  : Jamie Garroch
' Date    : 08APR2019
' Website : https://brightcarbon.com/
'----------------------------------------------------------------------------------

Sub RestoreDefaultLayouts()
  With ActivePresentation.Slides
    .Add(.Count + 1, ppLayoutTitle).Delete                ' Title Slide (slideLayout1.xml type="title")
    .Add(.Count + 1, ppLayoutObject).Delete               ' Title and Content (slideLayout2.xml type="obj")
    .Add(.Count + 1, ppLayoutSectionHeader).Delete        ' Section Header (slideLayout3.xml type="secHead")
    .Add(.Count + 1, ppLayoutTwoObjects).Delete           ' Two Content (slideLayout4.xml type="twoObj")
    .Add(.Count + 1, ppLayoutComparison).Delete           ' Comparison (slideLayout5.xml type="twoTxTwoObj")
    .Add(.Count + 1, ppLayoutTitleOnly).Delete            ' Title Only (slideLayout6.xml type="titleOnly")
    .Add(.Count + 1, ppLayoutBlank).Delete                ' Blank (slideLayout7.xml type="blank")
    .Add(.Count + 1, ppLayoutContentWithCaption).Delete   ' Content with Caption (slideLayout8.xml type="objTx")
    .Add(.Count + 1, ppLayoutPictureWithCaption).Delete   ' Picture with Caption (slideLayout9.xml type="picTx")
    .Add(.Count + 1, ppLayoutVerticalText).Delete         ' Title and Vertical Text (slideLayout10.xml type="vertTx") removed from O365
    .Add(.Count + 1, ppLayoutVerticalTitleAndText).Delete ' Vertical Title and Text (slideLayout11.xml type="vertTitleAndText") removed from O365
  End With
End Sub

You should now see something like this:

Because this code is just a single Sub procedure called RestoreDefaultLayouts, it’s referred to as a macro.

Now this isn’t an article aimed at explaining how to program in VBA but briefly, this is what the macro does:

  1. Creates a temporary slide at the end of the presentation using each of the default layouts, deleting the temporary slide after each operation.
  2. This action forces PowerPoint to recreate any missing layouts in the master with all the necessary hidden data not available to me or you.

Running the VBA Macro

Now you have the macro in your presentation you can use Alt+Tab to return to the more familiar PowerPoint window. From here, the macro can be run by pressing Alt+F8 on your keyboard which opens a window containing a list of available macros:

Select the RestoreDefaultLayouts macro and then click the Run button. The macro will do its magic, recreating any missing default Office layouts in your slide master.

Once you’re all done, you can go back to the VBE and right click on the VBA module to delete it. You need to do this as VBA can’t be saved with pptx files and you won’t want to send your presentation as a pptm file, the type that supports embedded VBA code.

So, there you have it. A quick an easy way to get your default Office Theme layouts back in your slide master, saving hours of head-scratching.

For more on constructing a PowerPoint deck check out our templates and masters resource. We also have a few great tools to help you with the technical side of PowerPoint, like this video embedding tool to help you find out what type of videos will run for you, this step-by-step guide to compressing PowerPoint presentations, and our brilliant guide to PowerPoint grids.

Got something extra you’d like PowerPoint to do?

Check out our PowerPoint automation service which provides you with a custom solution to your specific needs.

 

Leave a comment
Written by

Jamie Garroch

Principal technical consultant

View Jamie Garroch's profile

Related articles

Dec 2024

You can do some really cool things in Microsoft Office with just a few lines of Visual Basic for Applications (VBA) - from creating your own custom formula in Excel to correcting branded content in PowerPoint to merging address data for a mail campaign in Word. And sometimes you need to share that VBA solution with colleagues and clients, via the Internet. A change that Microsoft rolled out at the end of March 2022 tweaks the process required by Windows users to gain access to this active content.

  1. Image of Madhavi Madhavi says:

    Hi Jamie – How can I generate Table of Contents (TOC) as an Agenda slide with Slide Title (with Hyperlink) and Slide Numbers?

    Is there any VB code for that?

    Help me if you have something of this sort.
    Thanks,
    Madhavi

    • Image of Peter Peter says:

      The standard way to do this I believe is to View the presentation in Outline View.
      You can then highlight the Slide Titles and slide numbers, and then Copy-Paste into a new Agenda slide to tidy up.
      You can probably also then build in the hyperlinks you’re looking for.
      Best wishes
      Peter

    • Image of Jamie Garroch Jamie Garroch says:

      Have you tried using the Zoom feature Madhavi? Richard posted a really nice blog article about that last week: https://www.brightcarbon.com/blog/powerpoint-zoom-links/

  2. Image of John Korchok John Korchok says:

    You can also create a new blank presentation, then copy and paste the default layouts into the slide master that’s missing them.

    • Image of Jamie Garroch Jamie Garroch says:

      I like that idea too John. Does this approach always work in terms of “following” the parent master object i.e. the layouts cannot be “orphaned”?

  3. Image of Peter Peter says:

    Jamie – thank you! – interesting approach.

    I’m working on someone else’s ppt’s, and have a small problem.
    They have ‘turned off’ the Date, Footer, and SlideNumber placeholders in
    Slide Master / Master Layout / Master Layout Placeholders
    Do you know of any VBA to access those flags, and get them turned back on?
    [I can fix the Insert / Header & Footer / Slide fields ok – but it’s the Master Layout Placeholder flags I can’t seem to access]
    Thanks again your good work.

    • Image of Jamie Garroch Jamie Garroch says:

      Hi Peter. Thanks to you for another great question! So if you open the slide master, select the ‘parent’ object in the thumbnail pane and then click the Master Layout button in the Slide Master tab you see some placeholder deselected? If so, you can add them back with VBA like this: ActivePresentation.Designs(1).SlideMaster.Shapes.AddPlaceholder(ppPlaceholderDate)

  4. Image of Mohit Sindhwani Mohit Sindhwani says:

    Thanks! This was just what I needed because I am working on creating a new theme for my slides and accidentally changed the ‘Title & Content’ slide rather than the Slide Master and was getting frustrated making changes to Slide Master and this ‘manually overridden’ layout. Since PPT doesn’t have a way to reset a layout to the Master Slide (yet), this was easier to do – remove the layout and add it back this way.

  5. Image of Jishnu Shaji Jishnu Shaji says:

    Thank you so much! I couldnt change the slide layout and then i realised i had deleted all the slides in the slide master :p.
    But i followed your steps and it came back.

    And if the macro thing doesnt come in the list then just hit the drop down menu below and select for all open presentations and it should come 🙂

    Once more thank you so much! 🙂

Leave a Reply

Join the BrightCarbon mailing list for monthly invites and resources

Tell me more!

I absolutely love this, thank you so much. I have shared your fabulous resources with many folks. Thanks for all the brilliant work you do!

Michaela Butterworth State of Kansas