PDA

View Full Version : [SOLVED:] Imported tables on multiple PPT slides



mcstring
04-23-2018, 04:53 PM
I import a slide deck of <100 slides weekly for a report. On every single one of these slides is a table that I need to delete. Is there a way to delete them all at the same time?

Paul_Hossler
04-23-2018, 08:39 PM
Put this in a standard module and see

If the table is in a Placeholder, it won't delete it -- just deletes inserted tables



Option Explicit

Sub DeleteTables()
Dim oPres As Presentation
Dim oSlide As Slide
Dim oShape As Shape
Set oPres = ActivePresentation
For Each oSlide In oPres.Slides
For Each oShape In oSlide.Shapes
If oShape.Type = msoTable Then
oShape.Delete
End If
Next
Next
End Sub

John Wilson
04-24-2018, 04:21 AM
As Paul said as written tables in placeholders will not be deleted. You can force this by replacing


If oShape.Type=msoTable Then
WITH
if oShape.HasTable Then

mcstring
04-24-2018, 07:26 AM
Paul,
This works perfectly.
Thank you!


Put this in a standard module and see

If the table is in a Placeholder, it won't delete it -- just deletes inserted tables




Option Explicit

Sub DeleteTables()
Dim oPres As Presentation
Dim oSlide As Slide
Dim oShape As Shape
Set oPres = ActivePresentation
For Each oSlide In oPres.Slides
For Each oShape In oSlide.Shapes
If oShape.Type = msoTable Then
oShape.Delete
End If
Next
Next
End Sub