3

PCで実行されるマクロがあります。他の誰かがそれを実行すると、次の例外がスローされます。

"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
4

2 に答える 2

0

Windows 10 (64 ビット)、Word 2003 で同じエラーが発生しました。

.Clear

つまり、直前に DataObject をクリアしました。

.SetText

編集:Windows 10(32ビット)、Word 2013でも動作します

于 2016-05-14T04:55:31.527 に答える