View Single Post
 
Old 12-03-2023, 02:12 PM
laith93 laith93 is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default Change The Dimensions of Second Shape on the Selected Slide Only

Hi,
I made this macro to change the dimension of the second shape in each slide

Code:
Sub ChangeDimensionsOfSecondShape()
    Dim slideIndex As Integer
    Dim shapeIndex As Integer
    Dim newWidth As Integer
    Dim newHeight As Integer
    
    ' Set the new dimensions
    newWidth = 100
    newHeight = 50
    
'     .Height = 428
' .Width = 930
' .Left = 15
' .Top = 77
    ' Loop through all slides
    For slideIndex = 1 To ActivePresentation.Slides.Count
        ' Check if there are at least two shapes on the slide
        If ActivePresentation.Slides(slideIndex).Shapes.Count >= 2 Then
            ' Get the second shape on the slide
            shapeIndex = 2 ' Change this index if the second shape is not the desired one
            With ActivePresentation.Slides(slideIndex).Shapes(shapeIndex)
                ' Change the dimensions of the shape
                .Width = 930
                .Height = 428
                .Left = 15
                .Top = 77
            End With
        End If
    Next slideIndex
End Sub
so how to edit it to change the dimension of the second shape on the selected slide only
Thanks
Reply With Quote