#16
|
||||
|
||||
Your 'TOC DOC' has nothing in it that Word would recognise as a Table of Contents. A Table of Contents in Word uses a TOC field, not a manually-created table with manually-input 'heading' entries and PAGEREF fields.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#17
|
|||
|
|||
previous post - with page ref description
Hi Paul,
Yes, actually I think I did mention before you gave the macro: see the following quote. |
#18
|
|||
|
|||
apologies for the confusion.
|
#19
|
||||
|
||||
There's nothing in the post you quote that would indicate to anyone who doesn't have the document in front of them that the 'Table of Contents' is anything like what it is in the document you posted.
Nevertheless, given that your 'Table of Contents' is what it is, I don't know what you'd expect a macro to do about it. It certainly isn't capable of being updated in anything like the normal manner. IMHO, you'd do better to delete the one you have and insert a proper one or, better still, get whoever created the existing one to use a proper one. The current approach is crazy.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#20
|
|||
|
|||
Hi Paul,
Let me know if the attachments are not what you are looking for? ofcourse when you get time. regards Umesh |
#21
|
||||
|
||||
I am not looking for any attachments at this time. My last post outlined the course of action I think you need to take.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#22
|
|||
|
|||
Hi,
Thanks again for your reply. Can you please advice how can we add exception (or kind of validation) so that the following code does not throw error - if there is no table of contents in the document. Sub AutoClose() ActiveDocument.TablesOfContents(1).Update End Sub |
#23
|
||||
|
||||
I previously advised you that that code would throw an error if there was no TOC in the document - and I supplied code that wouldn't. In any event, it's pointless updating fields upon close, for two reasons at least:
1. It requires a re-save of the document after updating, even if it's already been saved; and 2. Doesn't guarantee that the updated fields will be correct if the document is opened on another PC or even on the same PC with a different active printer.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Organizer does not update some styles | Jennifer Murphy | Word | 10 | 08-31-2015 08:54 AM |
live update | gilgold | Excel | 0 | 05-26-2010 10:49 AM |
VBA to update certain (but not all) fields | sparkyrose | Word VBA | 0 | 05-20-2010 12:50 PM |
Project Auto-Update | hB-sys | Project | 0 | 04-15-2010 06:46 AM |
MS update failure | kbstinky | Outlook | 0 | 07-18-2009 10:59 AM |