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 Wizard
    Joined
    Apr 2007
    Posts
    5,867
    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
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    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)
    (multiple files can be selected while holding Ctrl key) / 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
    1,687
    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
    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

Posting Permissions

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