![]() |
#1
|
|||
|
|||
![]()
I have created a template with fillin fields and a table of contents. When I open the template as a document the TOC reverts to show all pages as page 3 (the page number the TOC is on) rather than the actual page numbers themselves. if I update the TOC then it corrects itself, but is there a switch I can set to ensure that it updates automatically on open so all the user has to do is to save the document with a new name and print rather than having to remember to update fields.
Many thanks |
#2
|
|||
|
|||
![]()
First, the correct way to be using a Template is to create a new document based on it. Many fields update automatically when you do this. What happens when you create a new document by double-clicking on the template's icon?
Templates in Microsoft Word |
#3
|
|||
|
|||
![]()
I am opening the template as a document which is why it does not have a name only document 1 etc.
The TOC is there, the fillin fields are correctly populated but I need to manually RMB and update fields to get the TOC to populate correcty (or click the update button). users then save and print Many thanks |
#4
|
|||
|
|||
![]()
Send me the document at the parsed address below and I'll take a look at it.
wordfaq[at]addbalance[dot]com I am a trial lawyer and have other priorities, but I will look at it. The terminology or jargon of Word is that when you open a template, the template itself is on your screen and if type and save it, the template itself is changed. You use the template by creating a new document. This appears to be what you are doing but the terms you use confuse things. |
#5
|
|||
|
|||
![]()
I've looked at your document. If you can use macros, the following macro in your template should do the trick.
Code:
Sub AutoNew() ' See http://www.gmayor.com/installing_macro.htm ' Written by Charles Kenyon 2014-02-03 ' ' update TOC fields in a document Dim oField As Field For Each oField In ActiveDocument.Fields If oField.Type = wdFieldTOC Then oField.Update Next oField Set oField = Nothing End Sub Note, you will have to save this template as a .dotm template. |
#6
|
|||
|
|||
![]()
Thank you so much, this works perfectly.
Your help is really appreciated. |
#7
|
||||
|
||||
![]()
Simpler and more comprehensive:
Code:
Sub AutoNew() Dim TOC As TableOfContents For Each TOC In ActiveDocument.TablesOfContents TOC.Update Next End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
![]()
Paul,
Thanks for the code simplification. I learn something new every day. I just started with code to update all fields in the body of a document and restricted it. Your code is much more elegant. This template needs it in the AutoNew because for some reason the TOC pages reset to all be "3" in a new document based on the template. There are an (annoying) series of questions (ASK) or (FILL-IN) fields that trigger upon the creation of the new document and it may then be ready to go. A UserForm would be more user-friendly and flexible but this is what the OP has. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
RodneyJ | Word | 12 | 11-06-2014 06:17 AM |
Error message when opening any template | spiff1116 | Word | 6 | 11-04-2013 04:44 PM |
Which .pst is the correct .pst | dbsoccer | Outlook | 1 | 04-08-2012 12:12 PM |
Word normal template changed??? Auto correct file??? | Frankwhoa | Word | 0 | 03-10-2010 04:46 PM |
Template "File In Use" when opening 2 documents based on the same template | wendt | Word | 5 | 12-15-2009 12:37 AM |