Welcome to MSDN Blogs Sign in | Join | Help

The Microsoft Office Word Team's Blog

All things Microsoft Office Word, from the Word team.
Even More Word Q & A

This question came across my desk last week.

Can you add a section TOC in a Word document?

You have your main table of contents, or TOC, at the beginning of your document—but what if you want to create a separate TOC in one of the sections or chapters of your document?

For example, can you list your level 1 and level 2 headings in the main table of contents at the beginning of the document and list your level 3 headings inside the section of the document where they appear?

At this point, you may be thinking, "Of course you can. You just use field codes."

That's true. However, building a TOC from scratch in the Field dialog box can be daunting. And you don't have to do it that way—at least, not all the way that way.

Instead, to build a table of contents, you can start with the Table of Contents dialog box.

Adding a separate section TOC in Word?

First, create the table of contents that's going to go at the beginning of the document.

(Remember to assign styles to the all headings that you want to appear in your TOC.)

On the References tab, click Table of Contents, and then click Insert Table of Contents. In the dialog box, specify to show only two levels.

Click OK.

Now click where you want to insert the section TOC.

Click Table of Contents and Insert Table of Contents again, and then click Options. In the Available styles list, delete the values for Heading 1 and Heading 2, and then type 3 in the box for Heading 3.

Click OK twice—and when you're asked whether you want to replace the existing TOC, click No.

What if I want separate TOCs in more than one section?

Good question! This takes a little more time, but it can be done. To add a separate section TOC for each section or chapter, you need to use bookmarks. Select all of the text, including the headings, that you want in the first section TOC, and then on the Insert tab, click Bookmark.

In the Bookmark dialog box, type a name, such as Chapter1, click Add, and then click OK.

Create bookmarks for each section or chapter that will need a section TOC.

After your bookmarks are in place, you can insert the section TOC the same way that you did before. Just don't be alarmed when it shows every level 3 heading in your document. We're going to fix that.

Click next to that section TOC, and then press ALT+F9. Your TOC is replaced by a field code that probably looks something like this.

{ TOC \o "3-3" \h \z \u}

All you need to do is type \b and the name of your bookmark, like this:

{ TOC \o "3-3" \h \z \u \b Chapter1}

Press ALT+F9 again so that you can see the TOC. Press F9 to update it—and when asked, click to update the whole table.

Getting the rest of your section TOCs into your document is easy. Press ALT+F9 again to see the field code. Select it, press CTRL+C to copy it, and then paste it in each place that you want to add a TOC, changing the name to the correct bookmark name for that location.

After you paste and update the last section TOC, press ALT+F9 a final time, so that you can see all of the section TOCs in your document.

Done!

- Joannie

Posted: Friday, May 09, 2008 1:51 AM by wrdblog

Comments

Peter Rohlfs said:

I would have posted on the Compatibility Part II but it is closed.  

We open a Word 2000 template with a macro in Word 2007.  Macro doesn't work.  I click convert and the macro works BUT if I save this as a Word 2007 file or a Word 2007 dotm file the macro is gone (or at least not working) when I open it.

How can I save theis into a working Word 2007 template?

Thanks,

Peter

# May 14, 2008 6:11 PM

Flug USA said:

I am just writing my master thesis and your post helped me so much!!! Thank you very much, Joannie!!! I´m so happy now, cause i wasn´t able to find this solution on my own!

Kiss Kiss:* :))

# May 19, 2008 6:09 AM

Michael said:

I have a question: I want to create a contract template. In the according text there are various places, where I would have to enter the customers name. How can I create a custom field (or something similar), where I can enter the needed information (e.g. customer name) and it is automatically updated at the various fields in the document?

I used so far the "Author" field available in Document Properties, but now I need the Autor for other purposes. Creating a custom entry seems not to work.

Michael (from Germany)

# May 27, 2008 7:10 PM

Alex Railean said:

Hi, I looked for a "contact us" page but did not find one, so here is my question:

I have read an article, the subject of which is justifying text vs. not justifying it. Although the first option seems more attractive to me and I always do it, it turns out this is not a good idea.

The article in question is this one: http://adamsdrafting.com/system/2007/05/03/justified-text-versus-ragged-right-text (it refers to other sources, which are mentioned there).

Could you comment that? I would like to find out how things are from the perspective of those who are on the other side of the barricades.

# June 18, 2008 9:41 AM

Stephen Barry said:

Great. But can these separate TOCs have different TOC level styles?

I am trying to use a TOC to provide a summary of recommendations, (where I have a recommendation style to identify each). I had managed to insert a TOC later in my doc sucessfully, however it had then changed the formating of my main TOC to be the same format as the new TOC. Not what I want.

# June 25, 2008 2:59 AM

Joannie said:

Alex, this does seem to be the hot debate right now (it even came up in my letterpress class, where we were setting lead type and debating the merits of justification). I'd need to do more research to give you a really fantastic answer--but the fact remains that some text will never look good justified, especially if you end up with a lot of loose lines that have gaping gaps in them. But if I find out something more, I'll post it.

Stephen, I've spent some time experimenting with this, and here's the answer:

To have a different style for your subTOC, you need to manually change the TOC style for that level. For example, if you're using TOC 3 for your subTOC, you need to change the attributes of that style to match what you want. Note that you can't use different styles for the same TOC level. Each level keeps its style attributes throughout the entire document.

I hope that helps.

# July 3, 2008 4:14 PM
New Comments to this post are disabled
Page view tracker