#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
Why not simply adjust the image sizes as required before you insert them into the document during the merge itself? - See http://www.gmayor.com/mail_merge_graphics.htm and http://www.gmayor.com/mail_merge_graphics_addin.htm
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thanks!
I tried this initially but was really struggling; I will try again using your handy guide though!
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Insert and resize image | lenguyenleduong | Word VBA | 2 | 05-11-2014 07:23 AM |
Shortcut for image resize | Hatthans | PowerPoint | 0 | 01-06-2014 04:32 PM |
Resize and align | AndyDDUK | PowerPoint | 9 | 11-09-2012 05:23 AM |
Resize and center tables | Ulodesk | Word Tables | 1 | 06-08-2012 09:25 PM |
Mail Mege Images - Path Correct but Images Repeated | Sonia Sosa | Mail Merge | 8 | 04-22-2011 03:05 PM |