Multiple Apps

Clear Windows Clipboard

Ease of Use

Easy

Version tested with

2000, 2002, 2003 

Submitted by:

Zack Barresse

Description:

This completely clears the contents of Windows Clipboard for all applications. 

Discussion:

Running short on memory? This is a good way to scrape up some free memory space really quick. Especially if you've been doing a large amount of copying/pasting in any Windows setting. This clears ALL clipboard contents. 

Code:

instructions for use

			

Option Explicit 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 Public Function ClearClipboard() OpenClipboard (0&) EmptyClipboard CloseClipboard End Function Sub ccc() Call ClearClipboard End Sub

How to use:

  1. Select and copy above code (Ctrl + C).
  2. From Excel, open the Visual Basic Editor (VBE) with Alt + F11.
  3. Select any file on left, choose Insert-Module from the menu.
  4. Paste code in right pane (Ctrl + V).
  5. Close the VBE with Alt + Q.
 

Test the code:

  1. From Excel, run macro 'ccc' by pressing Alt+F8.
 

Sample File:

cccEx.zip 6.01KB 

Approved by mdmackillop


This entry has been viewed 207 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express