Results 1 to 2 of 2
2015-10-18, 10:46 #1
- Join Date
- Oct 2015
- Thanked 0 Times in 0 Posts
Word- Automatically re-size picture with different size of cells (both width and height exactly)
Hi, I'm newbie in macro, I am looking to create a macro that will resize photos in Word. I bring in a number of photos, some are horizontal and some are vertically oriented. There are different amounts of photos each time I do this. I would like to have a macro that will resize the picture with height of selected cell height and the width of Cell width. The aspect ratio needs to be maintained for each photo.
Here is code that i use. but it need to change.
Sub FitPics() Application.ScreenUpdating = False Dim Tbl As Table, iShp As InlineShape With ActiveDocument For Each Tbl In .Tables For Each iShp In Tbl.Range.InlineShapes With iShp .LockAspectRatio = msoFalse .Height = .Range.Cells.Height If .Width > .Range.Cells.Width Then .Width = .Range.Cells.Width End If End With Next Next End With Application.ScreenUpdating = True End Sub
Last edited by FaizanRoshan; 2015-10-18 at 13:48.
2015-10-18, 17:34 #2
- Join Date
- May 2002
- Canberra, Australian Capital Territory, Australia
- Thanked 406 Times in 335 Posts
You have previously cross-posted on this topic on at least three other forums:
Furthermore, the code you have quoted above is code I provided you and you haven't even had the decency to acknowledge it. Not only that, on both of the other forums you have been advised of what is expected in terms of cross-posting etiquette: http://www.excelguru.ca/content.php?184
Last edited by macropod; 2015-11-09 at 05:39. Reason: More cross-posts foundCheers,
[MS MVP - Word]
The Following User Says Thank You to macropod For This Useful Post: