Count Slide Masters and Layouts in PowerPoint
Question details
Count the slide masters and the total layouts associated with them in a PowerPoint presentation.

- Product
- Microsoft PowerPoint
- Device & OS
- not provided
- Scenario
- A presentation contains multiple slide masters and many layouts, and the user wants a quick count.
- Observed behavior
- The desired result is a count of slide masters and a combined count of their layouts.
Open the presentation you want to count in desktop PowerPoint. Make sure the Visual Basic editor is available and that your organization's macro security settings permit you to run the macro.
Run a VBA Macro to Count Masters and Layouts
Use this macro to display the number of designs and the total layouts across their slide masters.
The macro counts PowerPoint designs as slide masters and adds up the CustomLayouts collection for each master. The layout total includes all layouts in those collections, not just layouts manually created by a user.
With the target presentation active in desktop PowerPoint, select Developer > Visual Basic. If the Developer tab is hidden, enable it in PowerPoint's ribbon settings.
In the Visual Basic editor, select Insert > Module and paste this code: Sub CountMastersAndLayouts() Dim x As Long Dim lLayouts As Long With ActivePresentation MsgBox .Designs.Count & " slide masters" For x = 1 To .Designs.Count lLayouts = lLayouts + .Designs(x).SlideMaster.CustomLayouts.Count Next x MsgBox lLayouts & " layouts" End With End Sub
Return to the target presentation, select Developer > Macros, choose CountMastersAndLayouts, and select Run. Dismiss the first message to see the layout total.

Check the Number of Presentation Slides
Use this method if you need the slide count rather than the master or layout count.
Work With PowerPoint Presentations in WPS Office
WPS Office is a free, lightweight alternative for working with presentations in a familiar interface. Open compatible PowerPoint files to make the move between applications easier; the PowerPoint VBA macro above is not a WPS fix.

Frequently Asked Questions
Does the macro count only layouts I created myself?
No. It counts every layout in each slide master's CustomLayouts collection, including layouts that came with the presentation or theme.
How can I see the slide masters and layouts without running a macro?
Select View > Slide Master in PowerPoint. The pane shows slide masters and their associated layouts, which you can inspect or count manually.
Why can't I see the Developer tab?
The Developer tab may be hidden. Enable it in PowerPoint's ribbon settings, then select Developer > Visual Basic or Developer > Macros.
Do I need to save the presentation as a PPTM file?
Use File > Save As and choose PowerPoint Macro-Enabled Presentation (.pptm) if you want to keep the VBA code in the presentation. A standard PPTX file cannot retain VBA macros.




