Consulting

Results 1 to 7 of 7

Thread: Vertical Alignment for single lines of text -- MSWord 2010

  1. #1
    VBAX Regular
    Joined
    Aug 2014
    Posts
    10
    Location

    Vertical Alignment for single lines of text -- MSWord 2010

    Is there a way to center selected text vertically? I have a document that looks like an essay with sentences, paragraphs, etc., however, some of the lines in the document have textboxes in line with the text that I drew in. But if you notice, lines with textboxes are slightly taller than lines without textboxes. This is fine but the issue is that the text on lines with a textbox sits at the bottom of the line, whereas the textbox sits in the middle of the line. I need a way to center the text on those lines vertically so that they're even with the textboxes. Thanks for any help!

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    I do not see that behaviour on my system. Are you sure they're textboxes and not borders? If textboxes, are you sure the paragraph line spacing in the textbox is the same as for the rest of the document?
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Regular
    Joined
    Aug 2014
    Posts
    10
    Location
    Yes they are textboxes and all the line spacing is set to 1 and the paragraph spacing is zero point. Hmm maybe I'm not explaining it well. Imagine some text on a line:

    The quick, brown fox jumps over the lazy dog.

    However, some of that text is in a textbox; say, "quick, brown fox". When I set the alignment of the textbox to in line with text, with no border, same font and size, same spacing, etc. as the rest of the doc, and I crop the textbox as small as it will go before cutting off any text, "quick, brown fox" remains slightly above the rest of the text on that line.

    I reproduced the problem in the attachment.
    Attached Files Attached Files

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    It's not the line-spacing within the textboxes that is the issue, but the positioning of the textboxes that is the issue. If your textboxes are in-line, they have to sit on the line and that means having enough space for any character descenders above the line too. I'd suggest changing the wrapping to tight (so you can move them vertically relative to the line) - or foregoing the textboxes - I can't see what you're achieving by using them.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Regular
    Joined
    Aug 2014
    Posts
    10
    Location
    Well I have a long document with various temperatures that get repeated throughout the document, so I created a userform to change all those temperatures. However, I need to allow the document to be edited as well, so in-line textboxes would allow for that, whereas other wrappings would be left in the wrong place in document should it be edited. I've managed to use active x textboxes and manually change their size values to get them to line up with the text around them though.

    But would there be a better approach to achieving what I'm trying to do? The reason I ask is because I ran into another odd problem that occurs occasionally when I enter new temperatures into the userform to be copied into the textboxes. Almost the entire value in each of the textboxes gets shifted such that it's almost completely out of the textbox, yet when I have design mode enabled, the values shift back and fit perfectly into the textboxes.

  6. #6
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    I'd suggest, then, you should consider using bookmarks and/or content controls. That would allow a true in-line output that also accommodates variable-width text and line-wrapping.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  7. #7
    VBAX Regular
    Joined
    Aug 2014
    Posts
    10
    Location
    Thanks! Bookmarks are working as a much better alternative.

Posting Permissions

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