![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
![]()
I have created a template with boilerplate text and a TOC. In the template, the page numbers in the TOC are correct. When I open a new document based on the template, all of the page numbers are “3.” I can’t figure out why.
This is a template that will be used by many people in a company, and they can’t all be expected to update the TOC. Also, they may need to go to a specific page when they open the new document. Because I can’t figure out why this happens, I want to write a macro that updates the TOC when they open a new document based on the template. I wrote this macro: Private Sub Document_New() ActiveDocument.TablesOfContents(1).Update End Sub But it doesn’t seem to work either. Can the problem be with “ActiveDocument.”? Thanks. |
#2
|
||||
|
||||
![]()
Where did you save the macro? It should be in the ThisDocument module of the template which should then be saved as macro enabled. That should then update the TOC, but do note that the TOC is a field that is not automatically updated.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
![]()
Thanks, Graham. I inserted the macro in the ThisDocument module, and it works fine. The template was already saved as macro enabled.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Auto-Update Amended Page Numbers? | herbertp | Word | 5 | 02-01-2013 02:20 AM |
Need a word template for reports where the numbers update automatically | cadonn | Word | 3 | 01-24-2013 07:08 AM |
Update TOC Page Numbers | gdh15 | Word | 1 | 11-02-2012 04:29 PM |
![]() |
nvidovic | Word | 2 | 05-23-2012 10:57 AM |
Update Document Template when Saving the Document File | bjbercaw | Word | 3 | 11-16-2010 02:03 PM |