Interrupting Close WORD dialog (WORD 97/2000)

I am defining a new template and one of the requirement is to do things in the background once the user has clicked on the Save button. Therefore, is it possible to interrupt the WORD close dialog to

1. auto generate TOC, list of Table, List of Figures (also if there are no tables/figures then leave blank not an error message (Error referencing .... as generated by MS Word)
2. get the document filename
3. update document properties