Build TOC via Fields

  • Thread starter Janet A. Thompson
  • Start date
J

Janet A. Thompson

I am generating a toc for a multi doc report using fields. It has always
worked fine in past but now it is not. Currently, my fields on my computer
have gone awry because when I open 1 of these docs, I see the code instead of
the result of the field (like auto captioned titles and cross refs). I don't
know if this is causing the toc fields not to work or not.

I've tried rebuilding them, putting them in a blank doc, making sure other
team members don't have any doc open, having them all in one folder and using
the syntax
Ctrl+F9 RD "name of file" Ctrl+F9

Does anyone have any ideas. What I get is sequential boxes telling me the
file cannot be found but it gives the filepath of C drive when in actuality I
have them on a server directory. When I used the automatic (2007) toc from
the ribbon, it did work but of course it had the wrong TOC styles. I want it
to use the styles from my template and that's when it gives me the boxes. As
a workaround, I could generate it from the 1st toc listed on the ribbon and
then modify the toc styes to what they shoujld look like. But I really want
to know why that ain't work'in????

Thanks!!
 
M

macropod

Hi Janet,

I take it this is related to your other post, in microsoft.public.word.docmanagement.

Word fields aren't created via strings like:
Ctrl+F9 RD "name of file" Ctrl+F9
or by pressing Ctrl+F9 before & after typing the field code.
If you were creating a field manually, you'd press Ctrl+F9 to create a pair of field braces, which look like '{ }', then you'd type
'RD "name of file"' between them, so that you'd end up with '{RD "name of file"}'.

Programmatically, you'd create the same field via code like:
ActiveDocument.Fields.Add Range:=Selection.Range, Text:="RD " & Chr(34) & "name of file" & Chr(34), PreserveFormatting:=False

Two things to note about RD fields:
1. Word formats them as hidden text, so they tend to disappear as soon as you type 'RD', which makes editing 'interesting' if you're
not displaying hidden text; and
2. If there's an error in the field coding, the field code will remain visible (subject to your 'hidden text' visibility settings).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top