Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2007
    Location
    Seattle, Washington, USA
    Posts
    85
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Objects in sentence - horizontally centered? (2003)

    Does anybody know of an easy way to balance objects up and down in a sentence? That is, to have half the object above the line of text and half below?

    I am typing scientific expressions which have ChemDraw chemical structures interspersed with the words of the sentence, like "where R = [ChemDraw object] and S = m". Currently the bottoms of the objects (which are generally several lines tall) line up with the bottom of the text characters, but I would like to have the horizontal center of the object in line with the text lines.

    These objects are inserted "IN LINE WITH TEXT", and must stay that way, but the effect I want (Format/Object/Layout/Advanced/PICTURE POSITION - VERTICAL ALIGNMENT CENTERED RELATIVE TO LINE) doesn't seem to be available for the "In Line With Text" setting.

    In the past I have relied on FORMAT/FONT/CHARACTER SPACING/POSITION/LOWERED [by varying number of points], but achieving a nice balance for each of dozens of differently heighted structures is a tedious matter of trial and error. There must be a setting….

    Thanks -- Judy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Objects in sentence - horizontally centered? (2003)

    I understand it's tedious, but there is no such setting. It should be possible to write a macro that sets the vertical position of the selected inline shape:

    Sub AdjustPosition()
    Dim dblLineHeight As Double
    Dim dblPictureHeight As Double
    dblLineHeight = Selection.Font.Size
    dblPictureHeight = Selection.InlineShapes(1).Height
    Selection.Font.Position = -(dblPictureHeight - dblLineHeight) / 2
    End Sub

    or to adjust the position of all inline shapes within the selection:

    Sub AdjustPositions()
    Dim shp As InlineShape
    Dim dblLineHeight As Double
    Dim dblPictureHeight As Double
    For Each shp In Selection.InlineShapes
    dblLineHeight = shp.Range.Font.Size
    dblPictureHeight = shp.Range.InlineShapes(1).Height
    shp.Range.Font.Position = -(dblPictureHeight - dblLineHeight) / 2
    Next shp
    End Sub

    You can assign these macros to a toolbar button and/or keyboard shortcut for ease of use.

  3. #3
    Star Lounger
    Join Date
    May 2007
    Location
    Seattle, Washington, USA
    Posts
    85
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Objects in sentence - horizontally centered? (2003)

    Thanks Hans! I feel like I've been gifted a Harry Potter magic spell!

    I haven't actually tried your magic yet -- but will do so as soon as time allows. My solution that day was to just lower all the objects by the same amount (25 pts, I think), using the Format-Font-Character-Spacing settings, and F4-ing on each object. So far the author/attorney hasn't complained.

    Can't wait to try your code tho, it'll be a great learning curve for me. (Code is usually off my map -- nobody mentioned computer programming to me when I was in college (that was in the late 60s) and I've never picked it up. At that time girls were encouraged to major in Home Economics or Teaching. Sigh.)

    Judy

Posting Permissions

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