I have found a piece of code to delete all ppt slides one by one except the the Active one (Index 1). However, can any one help me in re-writing this code to action the code in one hit. I don't want to loop each and every slide as there will be about 300 slides to delete. This is the code I have:
Sub Deleteslides()
'This deletes all slides except Active Main one.
Dim Pre As Presentation
Set Pre = ActivePresentation
Dim x As Long
For x = Pre.Slides.Count To 2 Step -1
Pre.Slides(x).delete
Next x
End Sub
Sub Deleteslides()
Dim Pre As Presentation, arr(), x As Long, n As Long
Set Pre = ActivePresentation
ReDim arr(0 To Pre.Slides.Count - 2)
n = 0
For x = Pre.Slides.Count To 2 Step -1
arr(n) = x
n = n + 1
Next x
Pre.Slides.Range(arr).Delete
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With