Tom’s Tutorials For Excel: *Really* Clear the Clipboard
The Windows Clipboard is a temporary storage area for information that you have copied or moved from one place and plan to use somewhere else. You cannot see or touch the Clipboard but you can work with it to copy, cut, paste, and clear data.
There are some 30 types of data which can be copied onto your Clipboard beyond just text and formulas, such as graphics, charts, and hyperlinks. To truly empty the Clipboard requires more than just pressing the
Esc key or executing the VBA codeline
Application.CutCopyMode = False.
With Windows API, this VBA macro named ClearClipboard clears all data types on your Clipboard:
Public Declare Function OpenClipboard Lib "user32" _ (ByVal hwnd As Long) 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