OK, my question's a bit hard to explain, so please bear with me.
I am using VBA in Word 2003. In my DocumentBeforeClose event, I want to reconfigure my menu based on which document will become active.
To do so, I need to find the order of open windows (documents). If I use Application.Documents or Application.Windows, I get a collection of open documents in the order in which they were opened. However, I want the order in which they were last activated.
For example, say I have four documents open and I activate them in the following order:
• Doc2
• Doc4
• Doc3
• Doc1
If I close Doc1 (the active document), Doc3 becomes the active document (regardless of its order in the Application.Documents or Application.Windows collections). How do I programmatically find out which document is next in this order (ie. which document will become active when my active document is closed)?
I am using VBA in Word 2003. In my DocumentBeforeClose event, I want to reconfigure my menu based on which document will become active.
To do so, I need to find the order of open windows (documents). If I use Application.Documents or Application.Windows, I get a collection of open documents in the order in which they were opened. However, I want the order in which they were last activated.
For example, say I have four documents open and I activate them in the following order:
• Doc2
• Doc4
• Doc3
• Doc1
If I close Doc1 (the active document), Doc3 becomes the active document (regardless of its order in the Application.Documents or Application.Windows collections). How do I programmatically find out which document is next in this order (ie. which document will become active when my active document is closed)?