Excel请问VBA怎样实现清空剪贴板

更新时间:01-23 教程 由 情殇 分享

Excel请问VBA怎样实现清空剪贴板?

VBA 参考代码:

Option Explicit #If VBA7 Then Public Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hwnd As LongPtr) As Long Public Declare PtrSafe Function CloseClipboard Lib "user32" () As Long Public Declare PtrSafe Function EmptyClipboard Lib "user32" () As Long #Else Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As LongPtr) As Long Public Declare Function CloseClipboard Lib "user32" () As Long Public Declare Function EmptyClipboard Lib "user32" () As Long #End If Sub CallEC() Dim lngRet As Long lngRet = OpenClipboard(Application.hwnd) If lngRet Then EmptyClipboard CloseClipboard End If End Sub

先复制一段文字到剪贴板,然后运行 CallEC 过程,之后便会看到剪贴板被清空了。

声明:关于《Excel请问VBA怎样实现清空剪贴板》以上内容仅供参考,若您的权利被侵害,请联系13825271@qq.com
本文网址:http://www.25820.com/tutorial/14_2195968.html