Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-06-2017, 03:22 PM
macropodjr macropodjr is offline Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Windows 7 64bit Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Office 2016
Novice
Complex VBA Code to Resize Alternating Images at the End of a Mail Merge
 
Join Date: Sep 2017
Location: Southern California
Posts: 3
macropodjr is on a distinguished road
Default Complex VBA Code to Resize Alternating Images at the End of a Mail Merge

Hello!



I have been working on this project for work for a couple weeks now and cannot figure out how to write the macro according to the needs of the project. I am using mail merge to create a three different letters with the use of many If-Then-Else statements. There are links to two different images within each letter. The first image is a header that is formatted as the correct size. The second image is stretched to the wrong size and, when the image is toggled, the image is no longer stretched but it is still not the right size.

I have tried placing the image merge field in a text box that was the correct size but the image did not fit the box. I have tried to program a macro to resize the selected images but am unable to select every other image in the document. There are nearly 1,000 letters and if I am unable to figure this out I will have to resize every image manually.

I have searched far and wide for the answer but have come up empty handed. One thought I had was to program a macro that would resize every other image in a document to a certain height or width, while keeping the aspect ratio. If someone could help me write a macro for this that would be tremendous!!

I have attached an image of the mail merge document I am working with, the document it produces, and the ideal look of the document for clarity. The first name of the student has been blacked out for privacy purposes.

Sincerely,
macropodjr
Attached Images
File Type: png image1.png (101.9 KB, 22 views)
File Type: png image2.png (144.2 KB, 22 views)
File Type: png image3-2.png (153.2 KB, 21 views)
Reply With Quote
  #2  
Old 09-06-2017, 04:47 PM
macropod's Avatar
macropod macropod is online now Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Windows 7 64bit Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

To constrain an image to fit within a given size, create a single-cell table with a fixed height and width to wherever you want the image to go, then insert the field code into that. The inserted images will resize, at the correct aspect ratio for the picture, to fit the space available. No VBA or post-merge processing required.

To create a single-cell table with a fixed height and width, use Insert|Table and choose one cell. Then, for the:
• rows, set the exact row height under Table Tools>Layout>Properties>Row>Specify Height>Exactly.
• columns, set the preferred column width under Table Tools>Layout>Properties>Columns,
and uncheck the 'automatically resize to fit contents' option under Table Tools>Layout>Properties>Table>Options. You might also want to set the cell margins to 0 all round. It's also a good idea to format the table paragraph with 0 before/after spacing.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-08-2017, 10:26 AM
macropodjr macropodjr is offline Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Windows 7 64bit Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Office 2016
Novice
Complex VBA Code to Resize Alternating Images at the End of a Mail Merge
 
Join Date: Sep 2017
Location: Southern California
Posts: 3
macropodjr is on a distinguished road
Default

Thank you for your response.

I have tried multiple times to create a single-cell table with a fixed size. The image does not fit to the size of the text box. The image remains its original size.
Reply With Quote
  #4  
Old 09-08-2017, 04:22 PM
macropod's Avatar
macropod macropod is online now Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Windows 7 64bit Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Cross-posted at: http://www.vbaexpress.com/forum/show...f-a-Mail-Merge
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 09-10-2017, 03:23 PM
macropod's Avatar
macropod macropod is online now Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Windows 7 64bit Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by macropodjr View Post
I have tried multiple times to create a single-cell table with a fixed size. The image does not fit to the size of the text box. The image remains its original size.
Unless your images are undersized - which is contrary to what your original post implied - it works if you follow the instructions given.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 09-11-2017, 11:10 AM
macropodjr macropodjr is offline Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Windows 7 64bit Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Office 2016
Novice
Complex VBA Code to Resize Alternating Images at the End of a Mail Merge
 
Join Date: Sep 2017
Location: Southern California
Posts: 3
macropodjr is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Thank you for showing me this. I was unaware of the issues with cross-posting and apologize for my error. I simply wanted to reach out to as many people as possible to try and find some answers. I have been working on this project for over a month now and am desperate for answers.

Thank you and my apologies,
macropodjr
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Complex Mail Merge based on Criteria fairchance Mail Merge 11 08-22-2015 04:32 AM
Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Help with VBA to resize images Yuffster Word VBA 2 01-30-2015 06:05 AM
Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Mail Merge - QR Codes Images Shrinking LWManson Mail Merge 2 08-19-2014 07:47 AM
Complex VBA Code to Resize Alternating Images at the End of a Mail Merge Help with a complex mail merge bekz Mail Merge 6 05-06-2012 07:10 PM
Inserting images into mail merge lorraine_hamilton Mail Merge 0 10-19-2009 09:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:05 AM.


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