• Objects in sentence – horizontally centered? (2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Objects in sentence – horizontally centered? (2003)

    Author
    Topic
    #448599

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1097474

      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.

      • #1098149

        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

    Viewing 0 reply threads
    Reply To: Objects in sentence – horizontally centered? (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: