Excel's Clipboard

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.
 
F

Frank Kabel

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
 
A

AJ

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?
 
F

Frank Kabel

Hi
works for me. Maybe you have to correct an error in the second line
(AsLong are two word: As long)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top