Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
JaneH JaneH is offline
external usenet poster
 
Posts: 15
Default Update table of contents in a protected for forms document

In Word 2003 I have created a template with form fields and styles. The
parts of the documents with fields are protected, the rest of the document
including the table of contents is not.

My problem is that I need the table of contents to update either when the
document is printed or with the F9 key or with the right mouse click update
fields and this will only happen if the whole document is unprotected. For
the sanity of the marketing team I cannot leave the document unprotected.

HELP!
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Update table of contents in a protected for forms document

The only reasonable way to achieve this is with a macro that unprotects the
document, updates the table of contents, and reprotects the document. This
should do:

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

You'll need to put this macro in the template, along with a keyboard
shortcut or toolbar button to run it. The template will have to be made
available to everyone who has to create or edit these documents -- if they
get the document without the template, the macro won't be available.

To make the macro run whenever the document is printed, you need two more
macros:

Sub FilePrint()
UpdateProtectedTOC
Dialogs(wdDialogFilePrint).Show
End Sub

Sub FilePrintDefault()
UpdateProtectedTOC
ActiveDocument.PrintOut Background:=False
End Sub

Read these articles to find out what to do with the macros.
http://www.gmayor.com/installing_macro.htm
http://www.gmayor.com/Template_Locations.htm
http://www.word.mvps.org/FAQs/Macros...buteMacros.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

JaneH wrote:
In Word 2003 I have created a template with form fields and styles.
The parts of the documents with fields are protected, the rest of the
document including the table of contents is not.

My problem is that I need the table of contents to update either when
the document is printed or with the F9 key or with the right mouse
click update fields and this will only happen if the whole document
is unprotected. For the sanity of the marketing team I cannot leave
the document unprotected.

HELP!



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
JaneH JaneH is offline
external usenet poster
 
Posts: 15
Default Update table of contents in a protected for forms document

Thank you Jay, that works a treat. I guess that I will have to learn VBA now.

Regards
JaneH

"Jay Freedman" wrote:

The only reasonable way to achieve this is with a macro that unprotects the
document, updates the table of contents, and reprotects the document. This
should do:

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

You'll need to put this macro in the template, along with a keyboard
shortcut or toolbar button to run it. The template will have to be made
available to everyone who has to create or edit these documents -- if they
get the document without the template, the macro won't be available.

To make the macro run whenever the document is printed, you need two more
macros:

Sub FilePrint()
UpdateProtectedTOC
Dialogs(wdDialogFilePrint).Show
End Sub

Sub FilePrintDefault()
UpdateProtectedTOC
ActiveDocument.PrintOut Background:=False
End Sub

Read these articles to find out what to do with the macros.
http://www.gmayor.com/installing_macro.htm
http://www.gmayor.com/Template_Locations.htm
http://www.word.mvps.org/FAQs/Macros...buteMacros.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

JaneH wrote:
In Word 2003 I have created a template with form fields and styles.
The parts of the documents with fields are protected, the rest of the
document including the table of contents is not.

My problem is that I need the table of contents to update either when
the document is printed or with the F9 key or with the right mouse
click update fields and this will only happen if the whole document
is unprotected. For the sanity of the marketing team I cannot leave
the document unprotected.

HELP!




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I link a Table of contents in a second document? RWFTOC Microsoft Word Help 2 October 8th 09 11:26 PM
Table of Contents from Word in a PDF document Eva Luna Microsoft Word Help 1 July 19th 06 12:45 AM
Update Table of Contents tikchye_oldLearner57 Microsoft Word Help 3 April 25th 06 02:37 PM
How can I show text in Table of Contents, not show in document? TDMBulk Microsoft Word Help 1 May 20th 05 04:38 AM
How to update only page numbers in Table of Contents in Word kevin Tables 0 May 10th 05 10:26 PM


All times are GMT +1. The time now is 11:34 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"