Consulting

Results 1 to 4 of 4

Thread: Imported tables on multiple PPT slides

  1. #1
    VBAX Newbie
    Joined
    Apr 2018
    Posts
    2
    Location

    Imported tables on multiple PPT slides

    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?

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    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
    Attached Files Attached Files
    Last edited by Aussiebear; 04-16-2023 at 11:12 PM. Reason: Adjusted the cod tags
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    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
    Last edited by Aussiebear; 04-16-2023 at 11:13 PM. Reason: Adjusted the code tags
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  4. #4
    VBAX Newbie
    Joined
    Apr 2018
    Posts
    2
    Location

    Red face Perfect!

    Paul,
    This works perfectly.
    Thank you!

    Quote Originally Posted by Paul_Hossler View Post
    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
    Last edited by Aussiebear; 04-16-2023 at 11:14 PM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •