Excel's Clipboard

  • Thread starter Thread starter AJ
  • Start date Start date
A

AJ

In my macro, I copy things from one file to another or
from one page to another. When I display the Clipboard in
Excel, the copied items stay on Excel's clipboard. When I
look at the Excel clipboard, I see 5, 6, 10 or 12 items on
it, as I continue to copy. I would like to clear the
Excel clipboard after each copy, just like I reset
variables.

Any suggestions or code on how to clear the Excel
clipboard would be greatly appreicatied. Thanks much.
 
Hi
have a look at
http://tinyurl.com/3yoqc


Try for example the following code:

Public Declare Function OpenClipboard Lib "user32" ( _
ByVal hwnd AsLong) As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long

Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Sub
 
I've tried that but I must be missing something. After I
run the code, I look at the office clipboard and the items
are still visible. Any suggestions?
 
Hi
works for me. Maybe you have to correct an error in the second line
(AsLong are two word: As long)
 
Back
Top