I need to get image ScaleWidth scaling factor and set ScaleHeight the same.
How do I get the image's height or width scaling factor?
Normally code such as this would scale with lock aspect ratio, but every time I produce a handout in PowerPoint I get very small images.
I use a macro to resize the picture, but these handout generated images do not scale with "lock aspect ratio" even if I use .LockAspectRatio = msoTrue
.
I want to scale the height myself.
After I scale the width to 18.46 cm, I want to get the ScaleWidth, and set the ScaleHeight to the same number.
Ex. If ScaleWidth ends up being 145 %, then get this number and set ScaleHeight the same.
I am not able to find a solution to get ScaleHeigth, and the guide to get Height pixel/inches is not something I am able to execute in my doc.
Sub Resize_All_Images()
'
' Resize all pictures to that corresponding size
'
'
With ActiveDocument
For I = 1 To .InlineShapes.Count
With .InlineShapes(I)
'the width that it will resize to'
.Width = CentimetersToPoints(18.46)
End With
Next I
End With
End Sub
Try this:
Sub Resize_All_Images()
'
' Resize all pictures to that corresponding size
'
'
Dim NewWidth As Long: NewWidth = CentimetersToPoints(18.46)
Dim ils As InlineShape
With ActiveDocument
For Each ils In .InlineShapes
With ils
'the width that it will resize to'
.Height = (.Height / .Width) * NewWidth
.Width = NewWidth
.LockAspectRatio = msoTrue
End With
Next ils
End With
End Sub