Results 1 to 2 of 2
  1. #1
    New Lounger
    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
        End With
        Application.ScreenUpdating = True
    End Sub
    Last edited by FaizanRoshan; 2015-10-18 at 13:48.

  2. #2
    Super Moderator
    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:

    Last edited by macropod; 2015-11-09 at 05:39. Reason: More cross-posts found

    Paul Edstein
    [MS MVP - Word]

  3. The Following User Says Thank You to macropod For This Useful Post:

    satrow (2015-10-19)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts