#1
|
|||
|
|||
Align and Distribute Images in Word with a Macro
Hello,
I am trying to get multiple (usually 3) images to align to each other. Basically, they need to be the same height, have a 1 inch border, aligned at the top, equidistant from each other(we can say .5 inches, I haven't decided yet), and all in a group. Here's what I have so far-- you select all 3 images and run this macro: Sub Test() Set myShapeRange = Selection.ShapeRange myShapeRange.Align msoAlignTops, False With myShapeRange .Line.Weight = 1 .Line.Visible = msoTrue .LockAspectRatio = msoTrue .Height = InchesToPoints(1.5) End With Selection.ShapeRange.Group.Select End Sub The process is we paste in 3 images and then do all of that stuff individually, so it's a nice time saver (we do it several hundred times a day, the time adds up). The only thing this won't do is distribute them evenly, and with a set distance from each other. I can click "distribute horizontally" in the format menu, but I want to be able to adjust how close the images are to each other (distribute horizontally makes them distribute inside of the total space the images cover originally). Any help is welcomed!! Thanks! TL;DR: pictures need to be .5 inches away from each other and aligned at their tops |
#2
|
|||
|
|||
Maybe a way to do that is the macro to create a table with 3 columns and then insert the images in each cell.
If the images are always the same size you can set rows height and coumns width as desired. Also the paragraph alignment of the cell can be used to get the desired result.
__________________
Backup your original file before doing any modification. |
#3
|
|||
|
|||
You might try https://gregmaxey.com/word_tip_pages...ry_add_in.html
|
#4
|
||||
|
||||
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Can't use a textbox
the pictures are never ever the same size-- screen shots from websites, not always the same websites, not always the same width (however, they are always the same height). I had made a version of this with a text box, but the department came back to me and showed how the text box is too limiting and inconsistent because of the width differences every time.
Is there not a way to standardize the distribution between images? Like, how if you click "distribute horizontally", it makes the two white spaces between the three images equal. Is there no way to distribute horizontally to a defined value? |
#6
|
||||
|
||||
You might at least try the code in the link I posted...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
I have a new issue
I did and oh my god that's so cool haha. I didn't realize you could make Input Boxes. It didn't necessarily make what I needed it to make, but I think I could rewrite parts/dimensions and it would work great.
That being said, So I actually semi resolved the issue with what I had written, and kind of streamlined it, so the original issue is resolved. BUT-- I gave it to the department, they ran it, and it didn't work at all (it worked fine for me). So I had her send me the document, and I checked the file, and it is in Compatibility mode. For reasons that I do not understand and cannot explain, our company has to have everything in compatibility mode. I converted her document to the most up-to-date version, and the macro ran exactly how I meant it to. Not sure if I'm allowed to post links on this forum, but this shows how Word treats pictures differently in different versions: https://answers.microsoft.com/en-us/...2-c7df89c4fa57 Any idea why something wouldn't work between versions? I'm going to mess around with what you sent me. I at least now have a new thing to practice/learn!! Thanks so much! |
#8
|
||||
|
||||
Whether the document is set to compatibility mode is immaterial. Neither is the Word version of any consequence. I'd suggest the non-performance for whoever you sent it to was due to user error.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Looking for Macro to Export Images | alex20850 | Word VBA | 2 | 01-10-2019 06:27 PM |
How to align this in the word table | ValentinaZaharia | Word Tables | 2 | 12-06-2018 01:58 PM |
How to link images by default when dragging images in word | maxbaeten | Drawing and Graphics | 3 | 09-27-2017 11:34 PM |
I want to enlarge images in word when I click on them by using a macro | MarloweCavendish | Word VBA | 1 | 08-16-2016 03:55 PM |
text to align on Microsoft Word for Mac | mrstwitch | Word | 1 | 08-15-2015 01:33 AM |