Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateneva/8dc7662b1be0624e279a480620b635fb to your computer and use it in GitHub Desktop.
Save ateneva/8dc7662b1be0624e279a480620b635fb to your computer and use it in GitHub Desktop.
How do I delete slides based on their layout or content?
Sub Delete_Slides_other_criteria()
Dim p As Presentation
Set p = ActivePresentation
Dim Sh As Shape
Dim PPS As Slide
Dim i As Integer
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'slides with a certain layout
For Each PPS In Ppres.Slides
If PPS.Layout = ppLayoutSectionHeader Then PPS.Delete
If PPS.Layout = ppLayoutBlank Then PPS.Delete
If PPS.Layout = ppLayoutChart Then PPS.Delete
If PPS.Layout = ppLayoutPictureWithCaption Then PPS.Delete
Next PPS
'slides that have more than a certain number of shapes on them
On Error Resume Next
For i = 2 To Ppres.Slides.Count
If Ppres.Slides(i).Shapes.Count > 1 Then
Ppres.Slides(i).Delete
Next i
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment