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]
|