View Single Post
 
Old 07-23-2018, 06:20 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit 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

That's as simple as:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
  For i = 1 To .Shapes.Count
    With .Shapes(i).PictureFormat
      .CropTop = CentimetersToPoints(3)
      .CropBottom = CentimetersToPoints(4)
      .CropLeft = CentimetersToPoints(1)
      .CropRight = CentimetersToPoints(2)
    End With
  Next
  For i = 1 To .InlineShapes.Count
    With .InlineShapes(i).PictureFormat
      .CropTop = CentimetersToPoints(3)
      .CropBottom = CentimetersToPoints(4)
      .CropLeft = CentimetersToPoints(1)
      .CropRight = CentimetersToPoints(2)
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
I suggest you spend a little time learning what methods are available to VBA for whatever you're trying to do.

Note: Cropping is calculated relative to the original size of the picture, not relative to whatever it may have been re-scaled to. If you've re-scaled the picture, you'll need to divide the crop factor by the rescale percentage - which could be different for the horizontal and vertical axes.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote