Select Page

Do you need a quick way to see which custom layouts are assigned to slides within your presentation?

You can do this manually by switching to the slide master view and then move your mouse over each layout to see which slides are assigned.

But there’s a quicker way!

Use a VBA macro.

The macro at the end of this post provides you with a way to quickly see all slide assignments in one simple window:

PowerPoint Slide Master Layouts Assignment

You can add it to your presentation by pressing Alt+F11 and inserting a new module into your VBA project before pasting the code (and the credit please)!

Then, once back in your presentation, simply press Alt+F8 and select the macro to run it.

Check out our blog for more PowerPoint automation tips and our commercial add-ins to make creating compelling content easier and more fun. We also develop custom macros and add-ins!

' VBA Macro for PowerPoint to display the slide master cusom layout assignments
'----------------------------------------------------------------------------------
' Copyright (c) 2014 YOUpresent Ltd.
' Source code is provide under Creative Commons Attribution License
' This means you must give credit for our original creation in the following form:
' "Includes code created by YOUpresent Ltd. (youpresent.co.uk)"
' Commons Deed @ http://creativecommons.org/licenses/by/3.0/
' License Legal @ http://creativecommons.org/licenses/by/3.0/legalcode
'----------------------------------------------------------------------------------
' Purpose : Displays the slide indexes that are assigned to slide master layouts
'
' Author : Jamie Garroch
' Date : 27AUG2014
' Website : http://youpresent.co.uk and http://www.gmark.co
'----------------------------------------------------------------------------------

Option Explicit

Sub ShowSlideMasterLayoutAssignment()
  Dim oSld As Slide
  Dim myLayoutAssignment() As String  ' Array to store the slides indexes assigned to each custom layout
  Dim myLayoutsCount As Integer       ' Number of custom layouts in the current presentation
  Dim myLayout As CustomLayout        ' Object to store each custom layout
  Dim sMessage As String              ' String for the output message to the user

  ' Get the number of layouts in the current presentation
  myLayoutsCount = ActivePresentation.SlideMaster.CustomLayouts.Count

  ' Redimension the dynamic array
  ReDim myLayoutAssignment(myLayoutsCount)

  ' Process each slide in the presentation, adding the slide index to the corresponding custom layout array row
  For Each oSld In ActivePresentation.Slides
    If myLayoutAssignment(oSld.CustomLayout.Index) = "" Then
      myLayoutAssignment(oSld.CustomLayout.Index) = myLayoutAssignment(oSld.CustomLayout.Index) & oSld.SlideIndex
    Else
      myLayoutAssignment(oSld.CustomLayout.Index) = myLayoutAssignment(oSld.CustomLayout.Index) & "," & oSld.SlideIndex
    End If
  Next

  ' Create the message for the user by cycling through the completed array
  For Each myLayout In ActivePresentation.SlideMaster.CustomLayouts
    sMessage = sMessage & myLayout.Name & " : " & myLayoutAssignment(myLayout.Index) & vbCrLf
  Next

  ' Show the message
  MsgBox "This presentation has slide master layouts assigned as follows:" & vbCrLf & vbCrLf & sMessage, vbInformation + vbOKOnly, "Macro by YOUpresent.co.uk"
End Sub