Excel VBA列出键绑定(OnKey?) [英] Excel VBA to list key bindings (OnKey ?)

查看:1237
本文介绍了Excel VBA列出键绑定(OnKey?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一大堆Excel vba脚本,其中一些是绑定键组合。

I am working with a large set of Excel vba scripts and some of them are bound to Ctrl-key combinations.

我知道如何一次设置一个在Excel用户界面中:拉出vba脚本列表(Alt-F8),选择一个脚本,然后单击选项。然后,您可以将脚本绑定/取消绑定到Ctrl-key组合。但是,您可以将多个脚本绑定到相同的键,Excel将选择一个(可能是以某种方式找到的第一个),并忽略其他绑定。

I know how to set one at a time in the user interface for Excel: Pull up the list of vba scripts (Alt-F8), select a script, and click Options. Then you can bind/unbind the script to a Ctrl-key combo. However, you can bind more than one script to the same key, and Excel will pick one (probably the first one it finds in some manner) and ignore the other bindings.

所以,我想将Ctrl-e分配给一个脚本,但是首先我必须找到它目前绑定的其他脚本,从数百个脚本列表中。

So, I want to assign Ctrl-e to a script, but first I have to find what other script(s) it is currently bound to, out of a list of hundreds of scripts.

有没有办法让Excel列出当前的键绑定(假设有一个VBA宏)?
我已经看到一个Word的解决方案,检查KeyBindings集合。但是,这在Excel中不起作用。 Excel有不同的对象吗?

Is there a way to get Excel to list the current key bindings (with a VBA macro, I suppose)? I have seen a solution for Word, that examines the "KeyBindings" collection. This is not working in Excel, though. Does Excel have a different object?

推荐答案

搜索一段时间后,我无法以编程方式获取列表所有键绑定。

After searching for a while, I could not find any possibility to programmatically get a list of all key bindings.

但是,如果您基本上想要了解哪个过程在快捷方式上运行,但是您不确定并且不想爬网您的个人工作簿,加载项等,您可以创建一个永远停止在执行的VBA代码的第一行的动态断点。为此,请简单地使用 Add Watch 对话框(右键单击代码窗口中的某个地方)输入以下参数:

However, if you basically want to find out, which procedure runs on a shortcut, but you're not sure and don't want to crawl through your Personal Workbook, Add-ins, etc., you can create a dynamic breakpoint that will always stop on the first line of VBA code executed. To do this, simple use the Add Watch dialog (right click somewhere in the code window) enter the following parameters:

然后,只需执行您感兴趣的快捷方式 - VBE将显示绑定到它的例程...

Then, simply execute the shortcut you're interested in - and the VBE will show you the routine that is bound to it...

这篇关于Excel VBA列出键绑定(OnKey?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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