Created
August 2, 2018 12:11
-
-
Save ateneva/8dc7662b1be0624e279a480620b635fb to your computer and use it in GitHub Desktop.
How do I delete slides based on their layout or content?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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