Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Style Corruption - Remove Unused Styles (2002)

    When I get documents from other users sometimes the styles seem to be corrupt - ie they have a number of descriptions following the main style name eg Heading 1, para 1, h1.... (refer to picture attached)
    I dont know if I add to this problem when I try to attach my template and apply company styles. In the past I have had to go into the tools-styles to rename all the heading styles so my macros work. Also, in my own templates I have found a list of styles that I did not create and do not seem to be from normal.dot (eg xl10...to ...xl29), nor have I created them (this may have been caused by copying a table or text from another document).

    I have two Questions:
    Why do the styles have so many descriptions following the standard name (so I can ensure this does not happen in the future)?
    Is there a method of deleting unused styles automatically?

    Any help would be greatly appreciated.
    Attached Images Attached Images

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Style Corruption - Remove Unused Styles (2002)

    I've never seen/noticed this before, but my guess is that each of the styles listed on each line shares that format of numbering. If this doesn't explain it (the solution being to delete those other styles, I guess), please post a sample of one of these documents for perusal (first removing anything proprietary, of course).

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

    Re: Style Corruption - Remove Unused Styles (2002)

    I have seen this before. I think it happens when you paste text from a document that uses a different local name for one of the built in heading styles. The most common way that I have seen is to paste text formatted as H1, H2 etc from a web site.

    I posted a Macro some months ago that renamed all of the built in styles by looking for a comma and truncating the name - I can't search for it now but someone may have a copy, if not then I guess I could write it again.

    StuartR

  4. #4
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Style Corruption - Remove Unused Styles (2002)

    Stuart & Jschr,
    Thanks for your feedback. If nobody posts the macro in the next week, could I trouble you to recreate it? Also, I will clean up the document in the next few days and post it on the website.

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Style Corruption - Remove Unused Styles (2002)

    Claude
    I know where you've been getting your files <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

    What you are looking at is style aliases and they provide a way of naming a style in multiple ways. Word 2002 has a bug which can cause aliases to be created automatically but that is not the issue you have encountered here. These ones you show come from a file where you have pasted in content that included styles with aliases added.

    The macro to remove style aliases looks like this and it doesn't change the look of the content at all - it just cleans the list of style names
    <pre>Sub RemoveAllStyleAliases()
    Dim aStyle As Variant, iPos As Integer
    For Each aStyle In ActiveDocument.Styles
    iPos = InStr(1, aStyle, ",")
    If iPos <> 0 Then
    aStyle = Left(aStyle, iPos - 1)
    ActiveDocument.Styles(aStyle).NameLocal = aStyle
    End If
    Next aStyle
    End Sub</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    2 Star Lounger
    Join Date
    Feb 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Style Corruption - Remove Unused Styles (2002)

    Andrew,

    Thanks for the macro, it worked a treat!

    Re files..... <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15> ........ <img src=/S/surrender.gif border=0 alt=surrender width=31 height=23> .......I'll send you an out of session email!

Posting Permissions

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