Any Code for Clearing the Clipboard After Paste...?

Frith

Board Regular
Joined
Nov 1, 2009
Messages
99
Hi all,

Anyone know if, in Excel (or in Windows in general, for that matter), there's a way to dump the clipboard AFTER AN INITIAL paste (like a "paste once" only kinda thing)? Say, I copy the word "cool" from some non-office App, then paste it in a WS. After pasting this, I need an empty clipboard... Do I ask the impossible?

Thanx,
Frith
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi again,


On that site, it says:

"Within Excel, you can clear Excel data from the clipboard with: Application.CutCopyMode = False."

So... now I do exactly "what" with this command? And if I do, will it still allow me to paste data "ONCE" before clearing the clipboard?


Thanx again
Frith
 
Upvote 0
Try like this

Code:
Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long
Public Declare Function CloseClipboard Lib "user32" () As Long


Sub pst()
ActiveSheet.Paste
Call ClearClipboard
End Sub


Sub ClearClipboard()
    OpenClipboard (0&)
    EmptyClipboard
    CloseClipboard
End Sub
 
Upvote 0
Nah, I'm still able to paste the same data multiple times in multiple cells, instead of just once... No worries, though. I guess I can live with it.

Thanx
 
Upvote 0
Nah, I'm still able to paste the same data multiple times in multiple cells, instead of just once

I can't. If I copy from notepad then run the Pst macro it pastes. If I run pst again it errors (because the clipboard is empty).
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top