2

I'm working on a macro for Word which detects key words in the text while these are typed. for example, I want that a Table will be added when the user types \table or something like that.. very similar to lyx context, but yet nothing like it.

The table example is very simple compare to the ideas I want to implement with this.

I'm looking for an event in VBA that will be triggered whenever the used types something.

There is an event called WindowSelectionChange (Reference: Event - Document Edited) but it triggers only whenever the SELECTION is changed, meaning only when the user selects another area in the document with the mouse cursor, or whenever the user moves with the keyboard arrows in the document, but doesn't triggers when the user types text (or press Enter, Space, etc...).

Community
  • 1
  • 1
rboy
  • 750
  • 9
  • 20
  • Sounds like "Auto Text" which was renamed "Building Blocks" in 2k7+ and it "hookable" in VBA http://msdn.microsoft.com/en-us/library/bb507736(v=office.12).aspx – Alex K. Mar 29 '12 at 17:44
  • Probably not what I'm looking for. I'll give you another example: I want that whenever the user presses the Tab key, it would create a table which its first column will be populated with the text typed so far in the line, and the next column would be empty.. or whenever the user typed some of the Math symbols Word is familiar with, it will automatically convert it to equation (in the Equation Editor).. – rboy Mar 29 '12 at 18:19
  • try autohotkey: http://stackoverflow.com/questions/31470984/capturing-keydown-event-of-ms-word – wideweide Jul 21 '15 at 09:22

1 Answers1

0

Seems an answer is explained here: What events can I use to monitor users typing in Word? Shortly - no events on type text in word: use either Windows API hooks, or assign key bindings to all keys.

Bryn
  • 385
  • 3
  • 15