简体   繁体   English

VBA宏—如何访问剪贴板?

[英]VBA Macro — How can I access the clipboard?

I'm new to programming, so this is (hopefully) a simple question. 我是编程新手,所以(希望)这是一个简单的问题。

I'm catching cut, copy, and paste operations in Microsoft Word via macros -- currently, messages like "PASTE!" 我正在通过宏捕获Microsoft Word中的剪切,复制和粘贴操作-当前,消息为“ PASTE!”。 pop up when a paste operation takes place, etc. However, when these messages pop up, the actions themselves do not take place. 粘贴操作等发生时弹出。但是,当这些消息弹出时,动作本身不会发生。 For example, if I have "hello world" on my clipboard and press ctrl+v, the "PASTE!" 例如,如果我的剪贴板上有“ hello world”,然后按ctrl + v,则显示“ PASTE!”。 message is shown, but "hello world" is not added to the document. 消息已显示,但“ hello world”未添加到文档中。

It was simple for me to add cut and copy commands to the macros, but I'm confused as to how I can access the clipboard for paste operations. 将剪切和复制命令添加到宏对我来说很简单,但是我对如何访问剪贴板进行粘贴操作感到困惑。

How might I go about adding this functionality for paste? 我应该如何添加此功能进行粘贴?

Well, now I sure feel silly. 好吧,现在我肯定觉得自己很傻。 Selection.Paste works. 选择。粘贴有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM