Consulting

Results 1 to 3 of 3

Thread: VBA to Delete all Images in a PowerPoint

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    VBA to Delete all Images in a PowerPoint

    Hi all,

    I'm currently looking for a simple VBA to delete all the images in a PowerPoint. I have tried solutions in a number of threads with no luck. At the moment I'm using a script which deletes all the pictures on a specific slide which works well but a simple 'delete all' button would be useful. The code I'm using at the moment is detailed below.

    Sub delete_pics()
    
    
    Dim osld As Slide
    Dim opic As Shape
    Dim lngCount As Long
    On Error GoTo err
    err.Clear
    For Each osld In ActiveWindow.Selection.SlideRange
    For lngCount = osld.Shapes.Count To 1 Step -1
    Set opic = osld.Shapes(lngCount)
    Select Case opic.Type
    Case Is = msoPlaceholder
    If opic.PlaceholderFormat.ContainedType = msoPicture Then opic.Delete
    Case Is = msoPicture
    opic.Delete
    End Select
    Next lngCount
    Next osld
    Exit Sub
    err:
    MsgBox "Did you select slides?"
    End Sub


    I'm new to Excel VBA therefore any simple code with simple instructions would be much appreciated!

    Thanks
    Last edited by Paul_Hossler; 06-09-2021 at 12:09 PM.

Tags for this Thread

Posting Permissions

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