Reputation:
I need to create a PowerPoint with 200-300 slides with a picture and the person's name on each slide. I turned to PowerPoint and VBA to get the job done. I've got the name issue handled. I've got the importing of images working with the Photo Album. It places the images large and in the center. I turned to using a Macro (see below) to move/resize the image. It only works for one slide. I've searched all over on how to loop so that it will do this for all slides but I can't figure it out. I'm new to VBA so I don't know where to begin. Thank you in advance for any advice or help!
Sub ResizeImages()
With ActiveWindow.Selection.ShapeRange
.Height = 400
.Width = 300
.Left = 45
.Top = 45
End With
End Sub
Upvotes: 2
Views: 1613
Reputation: 1
Here's the full code so you don't have to pull your hair out if your a noob like me
Sub pictureformatloop()
Dim sld As Slide
Dim shp As Shape
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoPicture Then
With shp
.Height = 300.3
.Width = 639.7
.Left = 1125.7
.Top = 270.4
End With
End If
Next
Next
End Sub
Upvotes: 0
Reputation: 41
try this:
Sub resizeImage()
Dim sld As Slide
Dim shp As Shape
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
With shp
.Height = 400
.Width = 300
.Left = 45
.Top = 45
End With
Next
Next
End Sub
Upvotes: 2