• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Macro Hacks > 69. Hack with Application Events

Hack with Application Events

Application events offer a powerful way to run VBA code when certain things happen within Word.

Windows is an events-based operating system. Most everything you do, from typing at the keyboard to scrolling within a window, triggers an event, which is then acted on by the program or the operating system.

Word exposes several events to you for use within your macros. For example, you can run a specific macro whenever the Word window is resized, or whenever the user right-clicks within a Word window.

If you have two Word documents open and you toggle between the two from the Window menu, three different events happen (in this order):

  1. The WindowDeactivate event

  2. The WindowActivate event

  3. The DocumentChange event


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint