Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2015, 03:53 AM
Yuffster Yuffster is offline Help with VBA to resize images Windows 7 64bit Help with VBA to resize images Office 2010 64bit
Novice
Help with VBA to resize images
 
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
  #2  
Old 01-30-2015, 05:32 AM
gmayor's Avatar
gmayor gmayor is offline Help with VBA to resize images Windows 7 64bit Help with VBA to resize images Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #3  
Old 01-30-2015, 06:05 AM
Yuffster Yuffster is offline Help with VBA to resize images Windows 7 64bit Help with VBA to resize images Office 2010 64bit
Novice
Help with VBA to resize images
 
Join Date: Jan 2015
Posts: 2
Yuffster is on a distinguished road
Default Thanks!

I tried this initially but was really struggling; I will try again using your handy guide though!
Reply With Quote
Reply



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
Help with VBA to resize images Resize and align AndyDDUK PowerPoint 9 11-09-2012 05:23 AM
Help with VBA to resize images Resize and center tables Ulodesk Word Tables 1 06-08-2012 09:25 PM
Help with VBA to resize images Mail Mege Images - Path Correct but Images Repeated Sonia Sosa Mail Merge 8 04-22-2011 03:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft