Hi there,
I have struggled for hours trying to figure this out, but alas I need to ask. I am trying to create three different macros, for three specific photo sizes (Heights of 6.55, 9.86, and 12.5 with aspect ratio maintained). Essentially I want to be able to click each of these three options when needed. I think I figured it out here:, but then when I create the next macro my first one is gone for whatever reason. Any help would be appreciated.
Sub sizeone()
Dim targetHeight As Integer
Dim oShp As Shape
Dim oILShp As InlineShape
targetHeight = 6.55
For Each oShp In Selection.ShapeRange
With oShp
.Width = AspectHt(.Height, .Width, CentimetersToPoints(9))
.Height = CentimetersToPoints(6.55)
End With
Next
For Each oILShp In Selection.InlineShapes
With oILShp
.Width = AspectHt(.Height, .Width, CentimetersToPoints(9))
.Height = CentimetersToPoints(6.55)
End With
Next
End Sub
Private Function AspectHt(ByVal origWd As Long, ByVal origHt As Long, ByVal newWd As Long) As Long
If origWd <> 0 Then
AspectHt = (CSng(origHt) / CSng(origWd)) * newWd
Else
AspectHt = 0
End If
End Function