Automatic update of TOC in protected doc

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a word doc broken into a number of section breaks. My first section
contains form fields that I dont want anyone to re-format etc. My second
section contains my TOC. When I turn on protection I am selecting section one
only. My doc works correclty except for the TOC. Although it is not in a
protected section I cant update it automatically on print or preview. I have
the print options check box ticked for field updates. Everything else like
the footer page numbers in the first section update correctly. I cant figure
out why the TOC wont.

Any ideas appreciated
Regards
Sharpe
 
Hi Sharpe,

This is a 'known' bug, for which I've worked out a relatively simple
workaround:
. Create a SET field named 'MyTOC' after the formfield
. Cut and paste the real TOC into the SET field , thus:
{SET MyTOC {TOC}}
. Update the new field. It will create a MyTOC bookmark and more or less
disappear.
. Use a REF field where you want the TOC to appear, coded as:
{REF MyTOC} or, simply, {MyTOC}
. lock the form and use in the normal way.

If you then do a print preview after updating the formfields, the page
numbers in the substitute TOC will update, though you might have to do a
print preview twice to get the right result (I'm not sure why, but it may
have something to do with the REF field being located before the bookmark it
refers to).

Cheers
 
Thanks for the reply but I had no luck with your suggestion but I have since
found this which works a treat in a macro.

Dim doc As Word.Document
Set doc = ActiveDocument
If doc.ProtectionType <> wdNoProtection Then
doc.Unprotect
End If
doc.TablesOfContents(1).Update
doc.Protect wdAllowOnlyFormFields, True
 
Back
Top