Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    TOC inclusions (Word 97)

    I created a macro to insert TOC, excluding all styles except for H1, H2, H3 (MS Word had taken it upon its self to automatically include styles that Look Like headings). When I started the recording: Insert>Index/Tables>TOC>Options>deleted all styles that I didn't want to Include, OK, Ok.... End Macro. When I hit the "Insert TOC" button on my toolbar now, it gives me all of the styles that I had once deleted. And when I look at the Editor, it says to include styles H1-H3, and nothing else is listed..... What can I do to stop MSO from being so generous with the heading assignments? PS. I can't assign the Styles to a lower, unused outline number, as we are using 9 levels. - Jody

  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: TOC inclusions (Word 97)

    As a plan B, you could create the customized TOC and then select and save it as AutoText. I think a field saved as AutoText will still update after re-insertion.

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

    Re: TOC inclusions (Word 97)

    What is your code? Which styles do you actually want in the TOC?

    There are numerous ways to insert a TOC with the required content could be
    <pre>Selection.Collapse Direction:=wdCollapseStart
    ActiveDocument.TablesOfContents.Add _
    Range:=Selection.Range, _
    UseFields:=True, _
    UseHeadingStyles:=True, _
    LowerHeadingLevel:=3, _
    UpperHeadingLevel:=1, _
    AddedStyles:="myStyle,1,yourStyle,2"</pre>


    Jefferson's suggestion of an Autotext entry could be done without any code and would therefore be simpler than using code.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #4
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: TOC inclusions (Word 97)

    OK, I tried the code that you offered, but it still didn't do the trick. Though, I figured out what MSO did, and what I did as an accomplice. Headings 1-9 were outlined.... Additionally, I had a series of "Headings" that looked like Heading 1, but without the Outline. SO, when I created them style-wise, I said "based on H1". So, when MSoffice generated the TOC, it sucked in H1 and all headings based on H1 as well. When I altered the extra Headings to be based on normal, problem fixed...... and Now your code works. THanks - jody

Posting Permissions

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