使用ClipBoard_SetData()复制文本不起作用 [英] Copying Text using ClipBoard_SetData() doesn't work

查看:1108
本文介绍了使用ClipBoard_SetData()复制文本不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用使用 http://中的API函数将文本复制到Windows剪贴板的函数在Windows XP上使用Access 2003支持support.microsoft.com/kb/210216 .

该功能确实清除了剪贴板,但是在实际分配给剪贴板时却默默地失败了.单步执行代码并在立即窗口中查询错误不会产生任何结果.

The function does clear the Clipboard, but it silently fails on the actual assignment to the clipboard. Stepping through the code and querying for errors in the immediate window yields nothing.

我完全按照其网页上的说明复制并粘贴了MS功能.

I copied and pasted the MS function exactly as shown on their webpage.

推荐答案

我使用此功能,几乎可以完成相同的操作.它使用剪贴板的注册表项.试试看.

I use this function, which does almost exactly the same thing. It uses the Registry Key to the Clipboard. Try it out.

Public Sub CopyTextToClipboard(ByVal inText As String)
'***************************************
'       Background copy of any Text
'***************************************
    Dim objClipboard As Object
    Set objClipboard = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")

    objClipboard.SetText inText
    objClipboard.PutInClipboard

    Set objClipboard = Nothing
End Sub

因此,要复制您仅使用的任何测试,

So to copy any test you simply use,

CopyTextToClipboard "Hello World !!"

然后使用 Ctrl + V 进行粘贴.

这篇关于使用ClipBoard_SetData()复制文本不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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