I am executing a code in through Excel and I would like it to delete all slides in my PPT except for slide 1, 2, 3 and 17. I can't seem to get it to work.
Here is a snip that deletes all slides in the presentation, how can the exception be implemented?
For i = ppApp.ActivePresentation.Slides.Count To 2 Step -1
ppApp.ActivePresentation.Slides(i).Delete
Next
Try this:
Dim arrSheetsToKeep As Variant
arrSheetsToKeep = Array(1, 2, 3, 17)
For i = ppApp.ActivePresentation.Slides.Count To 1 Step -1
If IsError(Application.Match(i, arrSheetsToKeep, False)) Then
ppApp.ActivePresentation.Slides(i).Delete
End If
Next
Just fill arrSheetsToKeep
with the sheets you want to keep.