Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention. Check out this how-to article for more information.
Sub delPPTShapesActiveSlide() 'You can use early binding types, rather than object, on the below variables, by adding the Microsoft Powerpoint X.X Reference Library Dim oPPTApp As Object 'early binding use: PowerPoint.Application Dim oPPTFile As Object 'early binding use: PowerPoint.Presentation Dim oPPTSlide As Object 'early binding use: PowerPoint.Slide Dim oPPTShape As Object 'early binding use: PowerPoint.Shape Dim oPPTShapeArray() As Object 'early binding use: PowerPoint.Shape Dim i As Long On Error GoTo errHandler Set oPPTApp = GetObject(, "Powerpoint.Application") 'reference active powerpoint ' Reference active presentation Set oPPTFile = oPPTApp.ActivePresentation 'reference active presentation oPPTApp.ActiveWindow.ViewType = 1 'early binding use: ppViewSlide 'ensure in slide view mode, for modification Set oPPTSlide = oPPTApp.ActiveWindow.View.Slide 'gets the active slide 'enumerate shapes into array For Each oPPTShape In oPPTSlide.Shapes ReDim Preserve oPPTShapeArray(i) As Object 'early binding use PowerPoint.Shape Set oPPTShapeArray(i) = oPPTShape i = i + 1 Next oPPTShape 'then delete them, backwards to forwards, as there would be problems, deleting them serially For i = UBound(oPPTShapeArray) To LBound(oPPTShapeArray) Step -1 oPPTShapeArray(i).Delete Next i Set oPPTApp = Nothing Set oPPTFile = Nothing Set oPPTShape = Nothing Exit Sub
Join the community of 500,000 technology professionals and ask your questions.