Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    renaming of heading styles - whats going on???

    W97 -
    hi ya

    In this word doc the Heading 3 has been renamed with an obscure name.
    Can anyone tell me whats going on with word & the naming of the heading style.
    I have attached a screen dump of the word heading style to assist you.

    TIA Diana
    Attached Files Attached Files

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

    Re: renaming of heading styles - whats going on???

    Diana

    The bits after the "Heading 3," are all aliases for the style name. It means that you can use any of those styles and the result will be the same. This is MS's way of allowing you a quick way to type in long style names.

    I dislike all those aliases but they ultimately do no great harm. They can even prove useful to merge styles when combining multiple documents where different authors used different style names to do the same thing and you want to standardise the text.

    Because of my unreasonable dislike of the aliases I have a macro which simplifies the names again. It also fiddles the 'based on' properties as a sideline event.
    <pre>Sub CleanHeadNames()
    ' Macro created by Andrew Lockton
    Dim n As Integer
    For n = 1 To 9
    With ActiveDocument.Styles("Heading " & n)
    .NameLocal = "Heading " & n
    .AutomaticallyUpdate = False
    If n = 1 Then
    .BaseStyle = "Normal"
    Else:
    .BaseStyle = "Heading " & (n - 1)
    End If
    .NextParagraphStyle = "Normal"
    End With
    Next n
    End Sub</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    Andrew

    Do you know how those aliases occured?

    You mentioned that
    'different authors used different style names to so the same thing'

    does that mean that the different authors renamed the same style, that style having the same format?

    Diana

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    Andrew -

    For the alias names to appear
    could the styles have been generated in Word 6 doc & bought
    across to W97?

    Diana

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

    Re: renaming of heading styles - whats going on???

    Making the alias is as simple as renaming the style by adding a comma and typing. You can do this in the style list dropdown as probably the quickest way.

    Once done you can change a style by typing in either of the aliases.

    The aliases have been around for a long time and the file you have could have been created in various versions. If you copy some text from a file with aliases into a file without then you will have the aliases added to the accepting file. This ensures widespread dispersal of the 'infection'.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    > I dislike all those aliases but they ultimately do no great harm.

    I recall a problem when trying to build a list of "real" styles in a document. Maybe at the time that I was struggling I didn't realise there was a distinction between Aliases and the local name (maybe I still don't!).

    I had a user ask me to flush out unused, REALLY unused styles, and I think I got into trouble because I couldn't see that while 'Alias1' wasn't being used, it's real version WAS being used. Either I had problems deleting the alias, or I didn't have problems deleting the alias and inadvertently deleted the real style.

    I still have the blisters on my fingers!

  7. #7
    Lounger
    Join Date
    Jan 2001
    Location
    Milton Keynes, Buckinghamshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    In our production environment we regularly take styled Word documents into other applications, such as PageMaker, for pagination.

    In the past aliases to the Word style names have caused problems because PageMaker read the whole string of style name and aliases as a single style name, which then did not match the simple style name that had already been defined in the PageMaker style sheet.

    For this reason we outlawed aliases in Word style names, but they do reappear from time to time.

    The following bit of code will remove aliases from style names in a document style sheet:

    Dim Sty As Style
    Dim StyName As String
    Dim StyleNo

    For StyleNo = 1 To ActiveDocument.Styles.Count
    Set Sty = ActiveDocument.Styles(StyleNo)
    If Sty.InUse = True Then
    If InStr(Sty, ",") <> 0 Then
    StyName = Left(Sty, InStr(Sty, ",") - 1)
    ActiveDocument.Styles(StyleNo).NameLocal = StyName
    End If
    End If
    Next StyleNo

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    If I give you credit for this, can I please include it in the FORMAT menu of my Under-The-Hood application?

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    Thanks Andrew for enlightening me!
    Diana

  10. #10
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    Thanks Andrew for enlightening me on this issue - all very interesting!
    Diana

  11. #11
    Lounger
    Join Date
    Jan 2001
    Location
    Milton Keynes, Buckinghamshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    Chris,

    You are welcome to use this code. Please credit The Open University as well as myself, as the university owns the intellectual property rights for anything I produce.

    In your previous message you mentioned getting your fingers burnt trying to reduce a style sheet to just those styles that were really being used. I have a macro that searches through a document for all the styles contained in the document style sheet, and deletes from the style sheet any styles that are not actually being used in the document (with the exception of those built-in styles that are un-deletable). I could post a copy of this if you were interested. In its current form the macro is rather more elaborate than that, as I had to build in some safeguards to cope with legacy documents in which some of the style names contained 'illegal' characters (leading and trailing spaces or the null character) that were causing the macro to choke, but I could strip it back to its basics again.

  12. #12
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    <pre>Public Function CleanHeadNames(Optional strFollow As String = "",_
    Optional intTail As Integer = 0)
    ' Procedure : CleanHeadNames
    ' Description: Reset the heading styles to a user default.
    ' Copyright: Chris Greaves Inc.
    ' Inputs: STRING generic name of following paragraph style,
    ' Returns: A variant array of strings.
    ' Assumes: Nothing
    ' Side Effects: None.
    ' Tested: By the calls shown below.

    ' Original coding by Andrew Lockton
    ' Optional help by Geoff Whitfield
    Dim n As Integer
    For n = 1 To 9 ' Loop through the built-in types.
    With ActiveDocument.Styles("Heading " & n)
    .NameLocal = "Heading " & n
    .AutomaticallyUpdate = False
    If n = 1 Then
    .BaseStyle = "Normal"
    Else:
    .BaseStyle = "Heading " & (n - 1)
    End If
    If strFollow = "" Then
    .NextParagraphStyle = "Normal"
    Else
    .NextParagraphStyle = strFollow & String(intTail, Trim(n))
    End If
    End With
    Next n
    'Public Sub cmd_CleanHeadNames()
    ' Each heading style followed by a corresponding numbered Text style.
    'Call CleanHeadNames("Text", 1)
    ' Each heading style followed by the Normal style.
    'Call CleanHeadNames("", 1)
    ' Each heading style followed by one common Text style.
    'Call CleanHeadNames("Text", 0)
    'End Sub
    End Function
    </pre>


  13. #13
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    At the risk of being the lone maverick, I could point out that there are advantages in using aliases. When you want to switch styles & have many custom styles, it can offer a quick way. I know you can also put styles on a toolbar or give them a keyboard shortcut, but as much as I love keyboard shortcuts, there's a limit to how many you can memorize. A quick Ctrl+Shift+S & type one or two letters & your set.

  14. #14
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Phoenix, Arizona, USA
    Posts
    205
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: renaming of heading styles - whats going on???

    This has nothing to do with this post, but since you write many different macros, I am wondering if you wrote the macro that removes the default Word has set. I saw this recently and cannot remember who posted it.

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

    Re: renaming of heading styles - whats going on???

    Jan

    You've got me there. <puzzled expression>

    Can you rephrase your question? What default are you talking about? I am assuming it is something to do with styles.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Page 1 of 2 12 LastLast

Posting Permissions

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