Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    Aug 2006
    Posts
    784
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TOCs (Word 2003)

    Dear Woody’s Lounge,

    I am using a table of contents based on this code:

    TOC h z t " Main heading,1, Main sub-heading,2, Main sub,sub-heading,3.”

    However, whenever I actually update the TOC, Main sub,sub-heading is assigned TOC level 9, reather than 3, which I am programming it with. Any ideas as to what could be the problem? By the way, the style Main sub,sub-heading is assigned to outline level 3.

    Regards,

    JMT

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: TOCs (Word 2003)

    Could you attach a sample document? You can delete most or all of the text, but leave the TOC.

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

    Re: TOCs (Word 2003)

    The syntax you are using wont work. The t switch needs pairs of "stylename,#,stylename2,#,stylename3,#". Your last style breaks this pattern since the outline level number doesn't appear where it should.

    If you are using a style alias there then you should try
    TOC h z t "Main heading,1, Main sub-heading,2, Main sub,3”

    If you want two styles at the third level
    TOC h z t "Main heading,1, Main sub-heading,2, Main sub,3,sub-heading,3”

    And you should also lose the space after the opening quote and the full stop after the 3.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

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

    Re: TOCs (Word 2003)

    If your third level heading style name is Main sub,sub-heading, you should change it to Main sub-sub-heading or some such. The comma is the delimiter between the stylename, toc level, stylename, toc level, etc. And Word can't find a style named Main sub and can't figure out what to do with sub-heading (it's not a number), and then can't find a style named 3.

    PamC
    Pam Caswell

  5. #5
    5 Star Lounger
    Join Date
    Aug 2006
    Posts
    784
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOCs (Word 2003)

    If I were to change "Main sub,sub-heading" to "Main sub-heading 2" or such and were to add that change to the template on which the document is built, would there be a way to tell Word to change the style name in every document based on that template that were already in existence and saved on my hard drive? Some time ago, I tried doing this but the old style name was still showing up in my previously existing documents based on that template.

    In fact, I just opened up the template with the problematic "Main sub,sub-heading style," and found that the name had somehow morphed into "Main sub,sub-heading,Main sub-." So I changed the style name back to "Main sub,sub-heading," and it worked fine, but in my previously existing documents, the style "Main sub,sub-heading,Main sub-" was stills showing up, even though that document was set to automatically update the document styles.

    So even if I change my problematic style name to one that does not have a comma, I am afraid it will not automatically update in all of my other documents.

    Regards,

    JMT

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

    Re: TOCs (Word 2003)

    Once the comma is in there then updating the template makes no difference - you will need to remove the alias in every document that has it already. Another gotcha is if you copy content from a document with two aliases into a document with none or one then it will add the new aliases in the recipient document.

    There have been macros posted here which remove all style aliases from a file.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

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

    Re: TOCs (Word 2003)

    To change a style name, you can use find and replace one document at a time or use a macro that can perform the action for, say, all documents in a folder. Recording a macro to change a style name is easy. A search of the archives should find the code you need add to make it loop through your older documents.

    Changing the template doesn't change the document unless automatically update document styles is checked in each document. The update changes style settings in the doc to match those in the template and adds styles from the template that are not in the document. But it does not change style names in the doc or delete them from the doc.

    The comma in a style name marks the a style alias, or style abbreviation. So to Word, your third level heading style name is just "Main sub", and both sub-heading and Main sub- are oddly long abbreviations for it. This is what Andrew is talking about and why his ' TOC h z t "Main heading,1, Main sub-heading,2, Main sub,3" ' should work in your TOC field. (I think I read Andrew's reply after I posted mine.)

    So if you can live with the uninformative name for your heading style, your problem may be solved. If the style name needs to be meaningful to others, you should look into changing it.

    PamC
    Pam Caswell

  8. #8
    5 Star Lounger
    Join Date
    Aug 2006
    Posts
    784
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOCs (Word 2003)

    Thank you, all. I think I will just just go into the documents and manually find the old style name and replace with the new. I appreciate your help as it has cleared up the issue for me.

    JMT

Posting Permissions

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