VBA 禁用/启用快捷键组合

发布于 2024-08-16 09:03:07 字数 397 浏览 1 评论 0原文

我需要启用和禁用全选“Ctrl + A”的快捷键。

FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Disable

FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Rebind wdKeyCategoryCommand, ?? 

Ctrl + A 的命令参数是什么?

我在任何地方都找不到这个信息!

另外,我只想将它应用于我的模板:

CustomizationContext = ActiveDocument.AttachedTemplate

这似乎不起作用。它似乎适用于普通模板,因为如果我打开任何单词实例,快捷键仍然被禁用。

I need to enable and disable the shortcut key for select all "Ctrl + A".

FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Disable

FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Rebind wdKeyCategoryCommand, ?? 

What is the command parameter for Ctrl + A??

I cannot find this information anywhere!

Also I want to apply it only for my templates:

CustomizationContext = ActiveDocument.AttachedTemplate

This doesn't seem to work. it seems to apply to the normal template because if I open any word instance the shortcut key is still disabled.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拥有 2024-08-23 09:03:07

输入

 ?FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Command

在 VBA 编辑器的立即窗口中

 EditSelectAll

会显示,所以我猜这就是您正在寻找的内容。

对于第二个问题:当您禁用“Ctrl + A”时,您是否检查过 ActiveDocument.AttachedTemplate 不等于 NormalTemplate

Entering

 ?FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Command

in the Immediate Window of the VBA editor shows

 EditSelectAll

so I guess that is what you are looking for.

To your second question: did you check that ActiveDocument.AttachedTemplate is not equal to NormalTemplate when you disabled "Ctrl + A" ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文