Consulting

Results 1 to 3 of 3

Thread: Deleting lines from Master slide with specific condition

  1. #1

    Question Deleting lines from Master slide with specific condition

    Hi all!


    Needing help from expert... I managed to create the action which can delete all lines from the master slides. But the below code is deleting lines only on main master layout. The custom layouts linked to the main master slide are not getting affected by the code. I want to delete lines from the master and custom layouts linked to the master as well.

    Can anyone please help?


    Sub DeleteLine()
             Dim L As Long
         
        For L = ActivePresentation.SlideMaster.Shapes.Count To 1 Step -1
            If ActivePresentation.SlideMaster.Shapes(L).Type = msoLine Then
                ActivePresentation.SlideMaster.Shapes(L).Delete
            End If
        Next L
        
    End Sub
    Last edited by kperiyapalem; 03-08-2019 at 02:42 AM.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,864
    Location
    See if this does it

    Sub StartHere()
        Dim L As Long
        Dim ocl As CustomLayout
        Call deleteLine(ActivePresentation.Designs(1).SlideMaster)
        For Each ocl In ActivePresentation.Designs(1).SlideMaster.CustomLayouts
            Call deleteLine(ocl)
        Next ocl
    End Sub
    
    
    Sub deleteLine(obj As Object)
    Dim L As Long
        For L = obj.Shapes.Count To 1 Step -1
            If obj.Shapes(L).Type = msoLine Then
                obj.Shapes(L).Delete
            End If
        Next L
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    Awesome!

    Working perfectly. Thanks a lot for helping John.

Posting Permissions

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