Djani
03-22-2016, 03:00 AM
Dear all,
I have a VBA script that should remove all pictures/shapes in the active PowerPoint presentation, but it's not working. I'm not an expert in VBA, so could any of you help me out with this?
Sub DeleteAllPictures()
Dim sldTemp As Slide
Dim lngTemp As Long
Dim lngCount As Long
For Each sldTemp In ActivePresentation.Slides
For lngCount = sldTemp.Shapes.Count To 1 Step -1
With sldTemp.Shapes(lngCount)
If .Type = msoPicture Then
.delete
End If
End With
Next
Next
End Sub
It gives the error "ActiveX component can't create object" at "For Each sldTemp In ActivePresentation.Slides". It should be very simple, just deleting all shapes.
I do understand that I have to make a reverse loop in order to delete all pictures!
Yours sincerely,
Djani
I have a VBA script that should remove all pictures/shapes in the active PowerPoint presentation, but it's not working. I'm not an expert in VBA, so could any of you help me out with this?
Sub DeleteAllPictures()
Dim sldTemp As Slide
Dim lngTemp As Long
Dim lngCount As Long
For Each sldTemp In ActivePresentation.Slides
For lngCount = sldTemp.Shapes.Count To 1 Step -1
With sldTemp.Shapes(lngCount)
If .Type = msoPicture Then
.delete
End If
End With
Next
Next
End Sub
It gives the error "ActiveX component can't create object" at "For Each sldTemp In ActivePresentation.Slides". It should be very simple, just deleting all shapes.
I do understand that I have to make a reverse loop in order to delete all pictures!
Yours sincerely,
Djani