Greedo
Greedo

Reputation: 5543

What events can I use to monitor users typing in Word?

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?

Upvotes: 0

Views: 1134

Answers (1)

Cindy Meister
Cindy Meister

Reputation: 25663

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).

Upvotes: 1

Related Questions