Solved

MS-Word -- need help with modifying Table of Content (TOC)

Posted on 2014-03-14
14
601 Views
Last Modified: 2014-03-15
Hello Experts:

Please see attached Word document which contains 3 TOCs.   I need assistance with modifying the "Table TOC" and "Figure TOC".

Essentially, right now all table and figure references (in the chapters) will -- and have to -- display the following:

Table 1.  Structure ABC
Figure 1.  Koala in Australia Zoo

[Note: above are just test examples).


However, given that the actual document will contain hundreds of tables, I was advised that the words "Table" -- and "Figure" should not be listed in the TOCs.

The attached document provides examples what they should look like (please see page 2 and page 3).  

My question:  How do I modify the Table TOC and Figure TOC in order to remove the words "Table" + leading space before table #?   Same applies for the Figure TOC.

Note:  I don't not want to manually remove these words from hundreds of table references and then choose "update page # only".    Instead, when updating the entire table/TOC, I automatically want to display their reference numbers only.

PLEASE HELP!!

Thanks,
EEH
Modifying-TOC.doc
0
Comment
Question by:ExpExchHelp
  • 4
  • 4
  • 3
  • +2
14 Comments
 
LVL 34

Expert Comment

by:Dan Craciun
Comment Utility
Make the "Table " and "Figure " a differently named style than the "2. Western map".
Then you will be able to set the TOC style to the style of the text.

(Not related) If you want to do hundreds of pages with tables and images, please don't use Word. Try a desktop publishing software that is made specifically for this: Indesign, Quark, Scribus, Publisher if you don't have other choices.
You will save a lot of time and get a better looking output.

HTH,
Dan
0
 

Author Comment

by:ExpExchHelp
Comment Utility
Dan:

Thank you for the prompt response.    Could you please provide me more details how to change the TOC style?   Alternatively, any chance you provide me the example document.

Note:  I'm not forced to use Word, so unfortunately I don't have the flexibility to use a desktop publishing document as you suggested.   Good point though.  ;)

EEH
0
 
LVL 34

Expert Comment

by:Dan Craciun
Comment Utility
I tried with the different styles, it does not work. The TOC does not use StyleRef fields, simply collects the entire line.

That being said, if you insert the table and image captions using References->Insert Caption, you can use the /a switch to remove the "Figure 1" or "Table 1" part.
See here for the TOC parameters: http://news.office-watch.com/t/n.aspx?articleid=165&paginate=false

I've attached the modified file. It does not have numbering on the tables/figures names, but I guess you can apply a style with numbering on them to get them to look like you want.

PS1: if you want to see the field code in a Word document, press ALT+F9
PS2: if you're not forced to use Word, then why do you?

HTH,
Dan
Modifying-TOC-v2.doc
0
 

Author Comment

by:ExpExchHelp
Comment Utility
Thanks, Dan.

I looked a the ToT and ToF.   Both of them missing the numbers though.  

What I needed is to remove the word, e.g., Table + leading space before the number.  

How can it be modified to include them again?

Thx,
EEH
0
 
LVL 34

Expert Comment

by:Dan Craciun
Comment Utility
You add them using Numbering (I mean select the ToT, press Numbering on the ribbon, between Bullets and Multilevel List)

You'll probably need to add tabs as the formatting will change.
0
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
I think that the 'Style Separator' option should be usable here. This is the possibility to change the paragraph style mid paragraph, so that, as I understand it, the embedded paragraph style can be used to create the TOC.

However, the usage is less that intuitive, so I am hoping that our man-of-style, Eric Fletcher will notice and give us the benefit of his experience.
0
 
LVL 31

Accepted Solution

by:
Paul Sauvé earned 500 total points
Comment Utility
Hi - if this is the result you are looking for, I will ecplain how to accomplish it (THREE steps)...

PaulS
Modifying-TOC.doc
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 31

Assisted Solution

by:Paul Sauvé
Paul Sauvé earned 500 total points
Comment Utility
Insert the ToF and ToT with Include label and number UNCHECKED.ToF Select one line in one of the tables and click on Numbering

Open the Styles pane (Alt+Ctrl+shift+s), find the TABLE OF FIGURES style to Update Table of figure to match selection

In the second table, restart the numbering at 1
0
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
OK. I have now been able to get my head around Style Separators.

Style separators enable different paragraph styles to be applied to text within the same paragraph.They were introduced in Word 2002.  They are useful here because Tables of Contents and Tables of Figures can be created based on a style. The Insert Style Separator button does not appear in the menus by default, so a QAT or command bar button (depending on the Word release) must be added if you need to insert a style separator manually.

In use, the command changes the final paragraph mark of the selected paragraph into a Style Separator. This functionality makes it a bit difficult to selectively change the style of particular text  in a heading or a caption that has already been typed.

In the document you have supplied, the 'Figure' paragraph style that is used for the sample caption. Also in the document, you also have a 'Figure Caption' paragraph style that looks the same. The macro below applies the 'Figure Caption' style to the  text that you say that you want to appear in the table. After it has been run, the Table of Figures can then be created using the 'Figure Caption' style.
Sub ChangeParaStyle()
    Dim para As Paragraph
    Dim rng As Range
    Dim rng2 As Range
    Dim point As Long
    For Each para In ActiveDocument.Paragraphs
        If para.Style = "Figure" Then
            Set rng = para.Range
            If rng.start > point Then    'Code disturbs For Each current paragraph,
                                         'so make sure that we don't work on the same paragraph twice.
                Set rng2 = rng.Duplicate    'Inserting style separator
                rng2.Collapse wdCollapseEnd 'merges paragraphs,
                rng2.Text = vbCr & vbCr     'so add two more.
                rng.Select                     'Range has no InsertStyleSeparator method - 
                Selection.InsertStyleSeparator 'it only works on the Selection.
                rng.MoveStart wdCharacter, Len("Figure ") 'Trim the
                rng.MoveEnd wdCharacter, -1               'range
                rng.Cut                 'Move the text to
                rng.Move wdCharacter, 1 'the other side of
                rng.Paste               'the StyleSeparator
                rng.Style = "Figure Caption"
                rng.Select
                Selection.InsertStyleSeparator
                point = rng.End
            End If
         End If
    Next para
End Sub

Open in new window

0
 
LVL 21

Expert Comment

by:EricFletcher
Comment Utility
You can't do this automatically with the TOC field code. As you probably discovered, the Insert Caption dialog assists in entering the SEQ field and provides an option to include or exclude the "Figure" or "Table" identifier. Unfortunately, it puts it in as text, so it will be included in the TOC.

I don't not want to manually remove these words from hundreds of table references and then choose "update page # only".
You wouldn't need to do that manually. Choose your Table of Figures after it has been updated and open the Find & Replace dialog. In the Find what box, type "Table " (no quotes, but include the trailing space), then use More > Format > Styles and choose the Table of Figures style. Leave the Replace with box empty and click Replace All. This will remove all of the "Table " instances at once from the generated ToC, but won't affect any instances within the document  because they are within "Table" styled ¶s in your example.

Do remember that you'll need to repeat this if you rebuild the ToC — although the "Table " parts won't reappear if you simply update the numbering.

And as an aside re Dan Craciun's comment... While I would agree about using a page layout product for getting very fine design control, Word is quite capable of producing a very large document with tables and figures. I have several examples with >600 pages and several hundred complex tables, figures and many images. Word will certainly choke if you not used properly, but that is also true for products like InDesign.
0
 
LVL 34

Expert Comment

by:Dan Craciun
Comment Utility
I've seen examples of huge documents made in Word too. And I still pity their authors...

As someone who did print layout for a living in the early 2000s, I was forced to use Word for dictionaries, cause nested styles in Indesign weren't available yet and I was better with VBA than with JS.
Learned a lot about Word, did the job, hated it. Layout in Word is clumsy, the output lacks fine control for print, the time required to position elements in a page is huge compared with Indesign/Quark. Don't get me started on proxy images :)

My point: Word is very good for business documents, where you simply need to present text and some tables/images. Don't try to make it do everything. And definitely don't use it for jobs that require offset printing.

My 2¢
Dan
0
 
LVL 31

Expert Comment

by:Paul Sauvé
Comment Utility
There are always workarounds to get the results you want in Word. But they're always a pain in the thigh or thereabouts!
0
 

Author Closing Comment

by:ExpExchHelp
Comment Utility
Everyone... thank you for your feedback.   I truly appreciate it.

In the end, I will have to award the points to Paul for a most excellent solution.  

Again, I thank everyone for their contributions as part of this question.
0
 
LVL 31

Expert Comment

by:Paul Sauvé
Comment Utility
Thank you. Glad to be of assistance
Paul Sauve
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This article will show you how to use shortcut menus in the Access run-time environment.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now