Hello!
I'm looking to delete specific named objects and shapes in an existing PowerPoint presentation via VBA in Excel. I have identified each shape by a name, however, I cannot figure out how to utilize the exact name in VBA language that will clear the contents of these shapes. I do not need to loop through each slide in PPT; I would prefer to write code to go to a specific slide, select the shape and then delete it using the assigned name. However, all I can find online is how to loop through an entire presentation - yet, I can't even get that to work. I want to delete one named shape - how do I get this to work?
Please see simple code below - any guidance is much appreciated, thank you!
Sub ClearContents()
Dim papp As PowerPoint.Application
Dim ppt As PowerPoint.Presentation
Dim shp As Shape
Dim sld As slide
Set papp = New PowerPoint.Application
Set ppt = papp.Presentations.Open ("Path")
papp.Activate
papp.ActiveWindow.View.GotoSlide (3)
sld(3).shp("NINA").delete
End Sub
I'm looking to delete specific named objects and shapes in an existing PowerPoint presentation via VBA in Excel. I have identified each shape by a name, however, I cannot figure out how to utilize the exact name in VBA language that will clear the contents of these shapes. I do not need to loop through each slide in PPT; I would prefer to write code to go to a specific slide, select the shape and then delete it using the assigned name. However, all I can find online is how to loop through an entire presentation - yet, I can't even get that to work. I want to delete one named shape - how do I get this to work?
Please see simple code below - any guidance is much appreciated, thank you!
Sub ClearContents()
Dim papp As PowerPoint.Application
Dim ppt As PowerPoint.Presentation
Dim shp As Shape
Dim sld As slide
Set papp = New PowerPoint.Application
Set ppt = papp.Presentations.Open ("Path")
papp.Activate
papp.ActiveWindow.View.GotoSlide (3)
sld(3).shp("NINA").delete
End Sub