View Single Post
 
Old 01-30-2015, 03:53 AM
Yuffster Yuffster is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jan 2015
Posts: 2
Yuffster is on a distinguished road
Default Help with VBA to resize images

Hi all,

I have a mail merge document for letters that need a different signature adding to different letters. I have achieved this using the includepicture mergefield function, and then adding in a macro to resize the signatures to fit the space given.

One of the signatures is too small when it is resized according to my macro, so I was wondering if I could add in an IF/THEN style argument to use a different aspect ratio for that particular signature but I am still learning with VBA so any help would be much appreciated. My original macro is as follows:

Sub ResizeSignatures()
Dim targetWidth As Integer
Dim oShp As Shape
Dim oILShp As InlineShape
targetWidth = 2.5

For Each oShp In ActiveDocument.Shapes
With oShp
.Height = AspectHt(.Width, .Height, _
CentimetersToPoints(targetWidth))
.Width = CentimetersToPoints(targetWidth)
End With
Next
For Each oILShp In ActiveDocument.InlineShapes
With oILShp
.Height = AspectHt(.Width, .Height, CentimetersToPoints(targetWidth))
.Width = CentimetersToPoints(targetWidth)
End With
Next
End Sub
Reply With Quote