Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Feb 2004
    Location
    Houston, Texas, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set Figure Width (2000/SR1)

    Does anyone have a macro that would select each figure in a document and set it to the same width (e.g., 4 inches wide) while maintaining the aspect ratio? I'd really appreciate any help with this!

    Thanks,
    Caroline

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Set Figure Width (2000/SR1)

    This depends on how you have placed your graphics in the document. If the graphics are inline shapes then the following snippet might be of assistance. This one sets a maximum length or width but doesn't enlarge graphics below the limit so it could be simplified a lot to meet your request. If your graphics are of the floating variety then the code would be written differently.
    <pre>Dim i as Integer, iSize as Double
    iSize = 10 'cms
    With ActiveDocument
    For i = 1 To .InlineShapes.count
    If .InlineShapes(i).Height > CentimetersToPoints(iSize) Or _
    .InlineShapes(i).Width > CentimetersToPoints(iSize) Then
    If .InlineShapes(i).Height > .InlineShapes(i).Width Then
    .InlineShapes(i).Height = CentimetersToPoints(iSize)
    .InlineShapes(i).ScaleWidth = .InlineShapes(i).ScaleHeight
    Else
    .InlineShapes(i).Width = CentimetersToPoints(iSize)
    .InlineShapes(i).ScaleHeight = .InlineShapes(i).ScaleWidth
    End If
    End If
    Next i
    End With</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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