New feature! Upgrade and increase expert visibility of your issues with Priority Questions.
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
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.