我可以使用哪些事件来监视在Word中键入的用户? [英] What events can I use to monitor users typing in Word?

查看:59
本文介绍了我可以使用哪些事件来监视在Word中键入的用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一些在您键入Word时执行的代码.

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

我应该观察哪些事件来捕捉单个单词或字符?理想情况下,我宁愿不要通过某些dll调用来观察击键.我假设Word对象模型将公开本地VBA事件的某些类,但是只有两个事件对象:

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

没有任何发生在我身上的事件. (Document_Change事件似乎没有满足我的要求

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

当文档的文本内容更改时,是否有本机执行代码的方法?

推荐答案

Word提供 no 事件以捕获用户的键入.

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

剩下的:

    Windows API级别的
  • 键盘挂钩".

  • "keyboard hooks" at the Windows API level.

或为每个可能的组合键分配一个VBA宏 (一个KeyBinding).

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

这篇关于我可以使用哪些事件来监视在Word中键入的用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆