'How to select specific placeholder in Layout - Slide Master

I am trying to write a macro that resizes placeholders within layouts, but I do not know how to indicate them to VBA. I have tried several ways, and with the below code I get Method or data member not found. I also tried adding two variables (SM As Design and CL AS CustomLayout) and then point to CL with "SlideMaster.CustomLayouts(4).Shapes.Placeholders("Content Placeholder 2").Name" (as in Handling a Shape by its Placeholder Name in PowerPoint), but then I get Object Required error in the line where I set MasterPlaceHolder.

Could someone please advise?

Sub PlaceHolderResizer()
Dim LeftLimit As Single
Dim TopLimit As Single
Dim RightLimit As Single
Dim BottomLimit As Single
Dim DrawingAreaWidth As Single
Dim DrawingAreaHeight As Single
Dim MasterPlaceholder As Shape
Dim PlcHldr As Shape
Dim HorizontalDistance As Single
Dim VerticalDistance As Single


HorizontalDistance = 360
VerticalDistance = 144



Set MasterPlaceholder = SlideMaster.CustomLayouts.Shapes.Placeholders.Name("Content Placeholder 2")


     LeftLimit = MasterPlaceholder.Left
     TopLimit = MasterPlaceholder.Top
     RightLimit = MasterPlaceholder.Left - MasterPlcHldr.Width
     BottomLimit = MasterPlaceholder.Top - MasterPlcHldr.Height
     DrawingAreaWidth = MasterPlaceholder.Width
     DrawingAreaHeight = MasterPlaceholder.Height



    With ActivePresentation.Designs(1).SlideMaster.CustomLayouts(4)

        ActivePresentation.Designs(1).Shapes.Placeholders.FindByName("Content Placeholder 2").Select 'here I get the error
        
            With Selection
            
                .Left = LeftLimit
                .Width = (DrawingAreaWidth / 2) - HorizontalDistance
                
            End With
    
    End With


End Sub


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source