Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Mar 2008
    Location
    New York, New York, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compound styles in Word (2003/2007)

    Edited by HansV to break extremely long line

    I get files in from users that have crazy compound names, where it seems random new names get tacked on separated by a comma. Here's a great one that I got recently:

    Heading 2,h2,sh,H2,H21,H22,H211,H23,H212,H221,H2111,H24,H2 5,H213,H222,H2112,H231,H2121,
    H2211,H21111,h21,H241,H26,H214,H223,H2113,H232,H21 22,H2212,21112,h22,H242,H251,H2131,
    H2221,H21121,H2311,H21211,H22111,H211111,h211,H241 1,H27,H215,H224,H2114

    Does anyone know:
    1. How these get created?
    2. The best way to get rid of them? (Sometimes renaming still leaves you with some sort of compound, albeit somewhat shorter. I generally have to delete the style and recreate it to get it to go away completely.)
    3. Could this cause corruption in a file?

    Thanks for any advice.
    John

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Compound styles in Word (2003/2007)

    Have a look at the Macros in this thread and see if they help.

    StuartR

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2006
    Location
    Maryland, USA
    Posts
    690
    Thanks
    17
    Thanked 66 Times in 56 Posts

    Re: Compound styles in Word (2003/2007)

    This macro will get rid of style aliases. But note that if you have char (or unlinked) styles in your file, it is best to get rid of them *before* you attempt to get rid of the style aliases. I'm not seeing the style alias problem as much as I once did, so I suspect it happened more often in Word2002 than it does in 2003.

    Sub RemoveStyleAliases()
    Dim sty As Style
    For Each sty In ActiveDocument.Styles
    sty.NameLocal = Split(sty.NameLocal, ",")(0)
    Next sty
    End Sub
    From May 29, 2004 Editorium Update

    PamC
    Pam Caswell

  4. #4
    New Lounger
    Join Date
    Mar 2008
    Location
    New York, New York, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compound styles in Word (2003/2007)

    This isn't exactly the problem I described, but it is a problem I experience quite often. Unfortunately, these macros don't resolve the problem I have. The styles tend to begin with a space, like " Char Char", and often go from " Char Char 1" to " Char Char 20" or higher. The last macro in this thread was the closest to working, as it deleted anything that ended in "Char". I tried to modify it to delete the styles described above, but it gets an error when it reaches these styles, and skips over the command to delete them. When I comment out the Resume Next command, it stops the macro in its tracks.

  5. #5
    WS Lounge VIP
    Join Date
    Mar 2006
    Location
    Maryland, USA
    Posts
    690
    Thanks
    17
    Thanked 66 Times in 56 Posts

    Re: Compound styles in Word (2003/2007)

    Yours is the style alias gone mad problem, not the char, char problem. Try the remove style alias macro I sent. It removes all the aliases, leaving the original style name (in your example Heading 2) in tact.

    The remove unlinked styles macros, first change the based-on characteristic of the char style and then deletes it. Unless you change the workings of the macro drastically, it is unlikely to work because Word won't delete a built-in heading style--and you probably don't want it to delete your custom styles.

    Pam C
    Pam Caswell

Posting Permissions

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