View Single Post
  #4   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Outline Question

Fields in the document will update if you check the calculate on exit check
box of the last field to be tabbed out of. TOC updates require a bit more
effort. Run the following macro on exit froma form field. It will unlock the
form, update the TOC, and relock the form without destroying the content
entered into the field.

Sub UpdateAllTOC()
Dim oTOC As TableOfContents
Dim bProtected As Boolean
If ActiveDocument.ProtectionType wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If
For Each oTOC In ActiveDocument.TablesOfContents
oTOC.Update
Next oTOC
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
End Sub
--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



akkrug wrote:
I had to unprotect the form for the F9 update to work. This wiped
out the text when I re-protected the form. The TOC looks ok before
anything is keyed to the fields. One thing I noticed is that the
last item in the TOC does NOT have a box with a - sign in it
preceding the final section of the form.

If the TOC was created by Word from the Heading styles,
Insert-Reference-Index and Tables, then the TOC is a field. Single
click it, press the F9 key and update the entire table (or just
page numbers)
The TOC will then be syched with the map

"akkrug" wrote:

I have inherited an outline form that our users would like to be
able to key as much information as they need to without messing up
the table of contents. When I addd the form fields to the document
and then key enough information to generate another page, the table
of contents and Document map seem to get out of synch. Any idea
what I might be doing wrong? The users want to keep the same
numbering scheme but want to be able to key an unlimited amount of
text.

Thanks for the help!

Ken K.
--
akkrug