HansV wrote:To initialize app, ... You can't refer to ActiveDocument in app_Quit, ... You can do this, though:
(later: Please see the end-result
here)
Hans.
- You da man!
- You da man!
- You da man!
I have
attached updated versions of code for those who are interested (or who will follow)
I have to sit and think about the code and see how I'll use it; I appreciate that some of my "macro" code will be executed only after "it is too late", but here is where I stand ("on the shoulders of giants"):
I fire up word with Triggers.dot Global and two blank/empty/unchanged documents as before.
With "Document 2" active I click the
Close button (I learned that the smaller button below it is called the
Close Window button)
Every one of these buttons has a name can display it when you position the mouse on top of the button.
This fires up the "App_DocumentBeforeClose" event, which means, I believe, I can deal with the document knowing that the user has instigated a Close.
Now I have only "Document 1" available, and it is, of course, Active.
With "Document 1" active I click the
Close button
This fires up the "App_DocumentBeforeClose" event, and from this I infer that
whenever the user clicks on the
Close button I can have a single piece of code that deals with the event.
That's good to know.
But wait! There's more!
Because there was but one document, and the user has elected the
Close, MS Word assumes that we are to close the application.
So next the "App_Quit" macro fires up. In theory I have no document processing to do at this point, but presumably I could log some status to a file.
Finally the "AutoExit" fires up.
So here's my take on the Close button in Word 2003:
When two or more documents are open, the Close button behaves like a File, Close (or Document Close) event.
When only one document is open, the Close button is meant to shut down the application.
Which leaves me wondering if anyone has ever programmed the Close button to effect a FileCloseAll whenever it is clicked, removing the ambiguity of the button.
You do not have the required permissions to view the files attached to this post.