Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I link a Table of contents in a second document? | Microsoft Word Help | |||
Table of Contents from Word in a PDF document | Microsoft Word Help | |||
Update Table of Contents | Microsoft Word Help | |||
How can I show text in Table of Contents, not show in document? | Microsoft Word Help | |||
How to update only page numbers in Table of Contents in Word | Tables |