Reputation: 5543
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
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