Archive for August, 2023

h1

Word: Modify what’s shown in the TOC and create a standalone TOC for appendices

August 23, 2023

I needed to modify the table of contents (TOC) for a client’s template. Some items were appearing the TOC that they didn’t want there (e.g. appendix headings and headings using the Heading 1, 2, 3  No Number styles I’d created for them), and they wanted the appendices in their own TOC. The two sections of steps below explain how I did this.

All instructions are for Word for Windows.

Modifying what displays in the TOC

  1. Put your cursor inside the existing TOC (or in an empty space where you want the TOC to go, if you don’t already have one).
  2. On the References tab, click the Table of Contents icon in the far left of the ribbon.
  3. Click Custom Table of Contents.
  4. Click Modify.
  5. On the Table of Contents Options window, clear the numbers from the styles you do NOT want displayed in the TOC. Do not type a space or a zero or anything else—just delete the number.
  6. Click OK and when asked, update the TOC.
  7. Note: There’s a strange issue in Word where clearing these numbers works, but when you check these settings again, they’re back. To fully delete them from the TOC, you also have to change the level they are set to in the paragraph settings for each of the styles you DON’T want to show in the TOC. To do that, continue on with the next steps.
  8. Open the Styles Pane so you can see the styles.
  9. For EACH style you DON’T want in the TOC, do these steps:
    • Click the drop-down arrow to the right of the style’s name, then select Modify.
    • Click Format > Paragraph.
    • On the Paragraph settings window, change the Outline Level from Level 1 (or whatever level is set) to Body Text.
    • Click OK to close both style settings windows.
    • Repeat these steps for any other heading style you don’t want to appear in the TOC.
  10. Your TOC should now only list Heading 1, 2, 3 and any others you kept.

Adding a separate TOC for the appendices

In my client’s case, they had a separate style for appendix headings, called… wait for it… Appendix Heading. They wanted these to not be part of the main TOC (see above), but as a separate standalone TOC.

  1. Put your cursor in an empty space where you want the appendix TOC to go.
  2. On the References tab, click the Table of Contents icon in the far left of the ribbon.
  3. Click Custom Table of Contents.
  4. Click Modify.
  5. On the Table of Contents Options window, clear the numbers from ALL the styles you do NOT want displayed in the appendix TOC. Do not type a space or a zero or anything else—just delete the number.
  6. Find the Appendix Heading style (or the style name you use for your appendix headings) in the list and if the field is empty, type 1 in that space. It should be the only style in the entire list that has a number.
  7. Click OK.
  8. Words asks if you want to replace the existing TOC—say No. You want a new and separate TOC from the main one, so you must say No here.
h1

Word: Some macros won’t run

August 11, 2023

Here’s a new one to me… I have a couple of table formatting macros that I run on all tables in a document, but for some reason they wouldn’t run on a new client’s document. Instead I got this ‘Run-time error 4605’ message—the information varied according to what I was trying to do, but basically the different errors had the same number but slightly different text for the ‘method or property is not available because the current selection is locked for format changes’. I couldn’t find any relevant clues in Google.

I had NO idea what was causing this… until a day or so later when I checked some of the information in the front matter, where I found some content control boxes in certain table cells. I checked the properties of each (via the Developer tab) and some had a checkmark in the Contents cannot be edited checkbox.

I removed that checkmark, ran my macros successfully, then reset that property.

Update: This didn’t just affect my table macros, but also my ‘set language’ macros, which appeared to run, but didn’t change anything until I’d cleared those checkboxes. Also, I’ve now removed that checkmark fully as the client’s doc needed different info on the cover page, which I couldn’t add with those control boxes locked for editing..