Forms, Templates and Protection


L

Lee

I've created a document that contains forms. I've protected the sections of
the document with the forms; however kept the Table of Contents and other
sections of the document unprotected. When I save this document as a
template for others to use .. two things happen: 1. When I open the template
the TOC pages numbers reflect only one page and 2. I can not update or toggle
the field codes with the TOC. Is there away to allow the TOC to be updated
within the template.
 
Ad

Advertisements

C

Cindy M.

Hi =?Utf-8?B?TGVl?=,
I've created a document that contains forms. I've protected the sections of
the document with the forms; however kept the Table of Contents and other
sections of the document unprotected. When I save this document as a
template for others to use .. two things happen: 1. When I open the template
the TOC pages numbers reflect only one page and 2. I can not update or toggle
the field codes with the TOC. Is there away to allow the TOC to be updated
within the template.
This is a known issue. "Macropod" posted the following solution quite some time
ago:

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).

Alternative macro
Sub UpdateProtectedTOC()
Dim TOC As TableOfContents

With ActiveDocument
If .ProtectionType <> wdNoProtection Then
.Unprotect
End If

For Each TOC In .TablesOfContents
TOC.Update
Next

.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End With
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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