Win XP/Excel 2003/VBA…。
我有以下代码截获用户发起的所有粘贴活动(主菜单、上下文菜单和Control-V键),并将其发送到子TrappedPaste()。
.... Application.CommandBars("Edit").Controls("Paste").OnAction = "TrappedPaste" Application.CommandBars("Edit").Controls("Paste Special...").OnAction = "TrappedPaste" Application.CommandBars("Cell").Controls("Paste").OnAction = "TrappedPaste" Application.CommandBars("Cell").Controls("Paste Special...").OnAction = "TrappedPaste" Application.OnKey "^v", "TrappedPaste" ....
这个代码工作正常。奇迹发生在世界范围内的工作表首次展示期间,因为“编辑”不是“编辑”,“粘贴”不是用德语、法语和(a)leut和(z)apotec之间的所有其他语言“粘贴”:-o
问:
事先谢谢你的帮助
致以亲切的问候
工具栏上的每个控件都有一个 ID 它可以和 FindControl 功能:
ID
FindControl
? application.CommandBars("Edit").FindControl(msoControlButton, 22).Caption
哪里 22 是的ID Paste 按钮。据我所知,这个号码在不同语言中是相同的。 所以你可以在英文版中查找它们,然后用硬编码。
22
Paste