Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: Martyn999
I have used outline numbering for all the sections in my report, and have changed the font colour used for the numbers to a light grey. The heading itself is in the regular black. When making a table of contents the numbering is picked up as part of the textual heading, meaning it all becomes black. I want the number to be grey like in the main body, and can only think of two ways of doing this; neither of which I think is possible or don't know how to do.
Firstly is there a way to exclude the numbering from the contents text, so I could add it using numbering directly, therefore formatting it as needs be? Or is there a way of mixing styles/colours on the one line in a table of contents?
I don't want to format each line directly because this will be lost whenever I update the table, plus there will be many many lines to do!
Thanks in advance

The only way I know of for doing what you want is to write a VBA macro. What you can do is click on Tools/Macro/Record New Macro
Make sure you save it to your current doc and not to normal.dot (which happens to be the default)
Do your colour changing bits for one a few lines then stop the macro recording. Click on Tools/Macro/Macros and select the macro you have just created for editing.
Have a look at what it is doing and modify it to loop through the whole table of contents doing whatever you want. You can even record obtaining the table of contents and modify the output directly so all you have to do is run the macro and it will generate the TOC and colour it according to your wishes.
Just have a look at the vba generated: it is quite simple to modify.

For future reference, there is an Office Software Forum for these types of questions.
Life's more painless for the brainless.

Good idea, thanks for that. Strangely enough I just found out that if you untick the option to make hyperlinks for web view (in the TOC options) it seems to work correctly, picking up the colours itself!
However, your approach is certainly useful to bear in mind if this way stops working or I find other problems!
Thanks again

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |