Hi,
ThisDocument module, in regular document, is used to handle specific document events. In case of a template, event macros run for documents that use this template.
ThisDocument, as Document type object, also means a word document, where the referencing code is.
Document_Close procedure offers limited power to handle all the process. The application level events are much more convinient: aside of returning a reference to the document they offer more events and options, some are reported 'before' action. This approach requires more programming, but can benefit by customisation of some actions, not accesible in other way.
In your case (all code in the template), you need a class module for tracking application events and automatic procedure that instantiates the class. After hooking the required event, it can be handled programmatically, with your own messages.
Tto switch initial code: if you search word help for auto macros, you can find description of special 'AutoExec' procedure in 'Main' named module. That can be used to initialise the class and assign WithEvents application variable.
combo