PDA

View Full Version : [SOLVED:] Deleting lines from Master slide with specific condition



kperiyapalem
03-08-2019, 02:03 AM
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

John Wilson
03-08-2019, 07:47 AM
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

kperiyapalem
03-11-2019, 01:55 AM
Awesome!

Working perfectly. Thanks a lot for helping John.