PDA

View Full Version : [SOLVED:] Complex VBA Code to Resize Alternating Images at the End of a Mail Merge



macropodjr
09-08-2017, 03:57 PM
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,
202912029020292

macropod
09-08-2017, 04:22 PM
Cross-posted at: http://www.msofficeforums.com/mail-merge/36680-complex-vba-code-resize-alternating-images-end.html
Please read VBA Express' policy on Cross-Posting in item 3 of the rules: http://www.vbaexpress.com/forum/faq.php?faq=new_faq_item#faq_new_faq_item3

macropodjr
09-11-2017, 11:08 AM
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