View Single Post
 
Old 12-04-2023, 06:16 AM
JohnWilson JohnWilson is offline Windows 10 Office 2019
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Are you intending to run the code in Show mode or Normal Edit mode? The code would be different.
This code will only work in Edit Mode
Code:
Sub ChangeDimensionsOfSecondShape()
    Dim osld As Slide
    Dim shapeIndex As Integer
    Dim newWidth As Integer
    Dim newHeight As Integer
    'Edit mode only!
    ' Set the new dimensions
    newWidth = 100
    newHeight = 50
'set osld to currenht slide
Set osld = ActiveWindow.Selection.SlideRange(1)
        ' Check if there are at least two shapes on the slide
        If osld.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 osld.Shapes(shapeIndex)
                ' Change the dimensions of the shape
                .Width = 930
                .Height = 428
                .Left = 15
                .Top = 77
            End With
        End If
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote