Option Explicit
Sub PicturePositionAndSize()
'Print the position and the size of the active picture
'in immediate window and on a message box
'By Christos Samaras
'Check if the selection is a picture
With ActiveWindow.Selection
If .Type = ppSelectionShapes Then
If .ShapeRange.Type = msoPicture Then
'Print results in immediate window
Debug.Print "Picture Dimensions And Size:" & vbNewLine & _
"Top = " & .ShapeRange.Top & vbNewLine & _
"Left = " & .ShapeRange.Left & vbNewLine & _
"Height = " & .ShapeRange.Height & vbNewLine & _
"Width = " & .ShapeRange.Width
'Show results on a message box
MsgBox "Picture Dimensions And Size:" & vbNewLine & _
"Top = " & .ShapeRange.Top & vbNewLine & _
"Left = " & .ShapeRange.Left & vbNewLine & _
"Height = " & .ShapeRange.Height & vbNewLine & _
"Width = " & .ShapeRange.Width, vbInformation
End If
'In case the selection is NOT a picture warn the user
Else
MsgBox "Please select a picture first!", vbCritical
End If
End With
End Sub
Option Explicit
Sub ArrangePictures()
'Arrange all the pictures of the active presentation
'By Christos Samaras
Dim i As Integer
Dim j As Integer
'For each slide in presentation
For i = 1 To ActivePresentation.Slides.Count
With ActivePresentation.Slides(i)
'For each shape in active slide
For j = 1 To .Shapes.Count
With .Shapes(j)
'if the shape is picture determine its position and size
If .Type = msoPicture Then
'Change these properties accroding to your own needs
.Top = 87.84976
.Left = 33.98417
.Height = 422.7964
.Width = 646.5262
End If
End With
Next j
End With
Next i
End Sub
This sample presentation contains the VBA code described above. The pictures on every slide are not aligned.
1) So, align the picture on the first slide according to your own needs and then press ALT + F8. The macro menu will pop up. Select the “PicturePositionAndSize” macro and then press the Run button. A message box will pop up containing the picture dimensions. You can either write down the values (on notepad for example) or you can press ALT + F11 to view them on immediate window of VBA editor. Afterwards, at the VBA editor, copy these values to the other sub (“ArangePictures”). You will have to replace the green values with your own values:
.Left = 33.98417
.Height = 422.7964
.Width = 646.5262
2) If you have successfully completed the previous procedure, you can then press ALT + F8. From the macro menu select the “ArangePictures” macro and then press the Run button. The macro will format all the pictures of the presentation based on the format of the first picture.
Note that since I have already done the work described in 1, you can start from the procedure 2.
Download it from here
Resize Pictures During A Presentation
Export All Excel Charts To Power Point
Export Excel Ranges As Power Point Tables