我有一个运行在我的PC上的宏。当别人运行它,它会引发以下异常:使用DataObject.PutInClipboard时出现运行时错误方法
"Run-time error '-2147221036 (800401d4)'
DataObject:PutInClipboard CloseClipboard Failed"
这里是我的代码:
Dim buf As String, FSO As Object
Dim CB As New DataObject
Set FSO = CreateObject("Scripting.FileSystemObject")
With FSO.OpenTextFile(sFile, 1)
buf = .ReadAll
buf = Replace(buf, ",", Chr(9))
.Close
End With
With CB
.SetText buf
.PutInClipboard // Here cause the exception.
End With
您的代码适用于我。正如我所料,我想。当我使用API调用来访问剪贴板,然后尝试使用'PutInClipboard'方法时,我遇到了类似的错误。 – mkingston 2012-07-19 05:03:56
@mkingston谢谢。赶上麻烦真的很难! – shenhengbin 2012-07-19 05:20:26
是的,我可以相信它。祝你好运,对不起,我忍不住了。 – mkingston 2012-07-19 05:25:36