0

I'm trying to write some code which executes as you type in Word.

Which events should I observe to catch individual words or characters? Ideally I'd rather not observe keystrokes through some dll calls. I assumed the Word object model would expose some classes with native VBA events, but the only two event objects:

Word.Document
Word.Application

don't have any events that leap out at me. (Document_Change event doesn't seem to do what I want)

Is there a native way of executing a code when the text content of the document changes?

Greedo
  • 4,967
  • 2
  • 30
  • 78

1 Answers1

1

Word provides no events for capturing the user's typing.

That leaves:

  • "keyboard hooks" at the Windows API level.

  • Or assigning a VBA macro to each and every possible key combination (a KeyBinding).

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43