简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM