clipboard in excel

K

keri

I have a large piece of code involving copying and pasting LOTS of
data. I have application.cutcopymode = false after each paste line in
my code. However I am viewing the clipboard in excel ina task pane and
can see at the end of the code has 24 items in it.

Is there another way to clear these items so I do not end up with huge
amounts on the clipboard?
 
R

RB Smissaert

Try this:

Option Explicit
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As
Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long

Sub ClearClipboard()
If OpenClipboard(0&) <> 0 Then
EmptyClipboard
CloseClipboard
End If
End Sub

Then when you want to clear the clipboard just do ClearClipboard


RBS
 

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

Top