Results 1 to 4 of 4

Thread: Word 2010 Style

  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Word 2010 Style

    When opening documents in Word 2010, I have a DocumentOpen event that checks for our so-called Draft Line. If it's not already present, I add the required text, first adding the appropriate style.

    My problem occurs when one type of document opens and the cursor is in a text box at the very top of the document. It seems that when I add the style, the text box "definition" gets added to the style. So the new bit of text with this style, finds itself in a text box at an absolute distance from the top of the page.

    Is there a way to avoid having the style pick up the text box info? I wasn't even aware that a style could have a text box as one of its attributes.

    Thanks.
    Richard Barrett

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts
    You can delete the frame attribute on the style if it happens to exist

    eg
    ActiveDocument.Styles("Heading 2").Frame.Delete
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2006
    Location
    Maryland, USA
    Posts
    690
    Thanks
    17
    Thanked 66 Times in 56 Posts
    Quote Originally Posted by richardbarrett View Post
    .... I wasn't even aware that a style could have a text box as one of its attributes.
    Text boxes can't, but frames can. In addition to Andrew's suggestion, if you are adding the style manually, move the cursor away from the frame before you add the style. You might consider including the style in a style set that you can apply to the document.

    Pam

  4. #4
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts
    I see... thank you. And there's apparently no error with the delete method if there's no frame to delete. This will work well.

Posting Permissions

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