detecting if user has alt-tabbed to another doc

T

Tom_OM

I'm working on a Word plug-in that saves variables into a document and
then displays that info in a drop-down combo box. The problem is that
if the user alt+tabs into another document (or changes documents via
the Window menu) the combo box still displays the info from the
previous document.

I already have a sub that can clear and refill the combo box based on
which document is open. I need to figure out some way to detect if
the user has alt-tabbed to another document so that it will trigger
the sub that revises the comb box content.

Anyone know?
 
J

Jezebel

The application fires the WindowDeactivate and WindowActivate events
whenever the user moves from one window to another. Since each document is
in its own window, this necessarily includes tabbing to a new document.

In VB/VBA, you trap this event by creating a class module that contains a
withevents reference to the Word application object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top