|
|
|
|
|
|
Word
|
Clear the contents of the clipboard
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2003
|
Submitted by:
|
MOS MASTER
|
Description:
|
Programmatically clear the contents of the clipboard.
|
Discussion:
|
Your code adds a lot of data to the clipboard and to make sure the clipboard doesn?t reach its max size you can clear it to avoid errors and improve overall speed.
|
Code:
|
instructions for use
|
Option Explicit
Public Sub ClearClipBoard()
Dim oData As New DataObject
oData.SetText Text:=Empty
oData.PutInClipboard
End Sub
|
How to use:
|
- Open your Word document.
- Press Alt + F11 to open VBE.
- Insert-UserForm (insert -> UserForm) this is to make sure you can use the DataObject Object.
- Insert-Module. (Insert -> module)
- Paste the code there in the window at right. (F7)
- Close VBE (Alt + Q or press the X in the top right hand corner).
- Save the file.
|
Test the code:
|
- Copy something on to the clipboard.
- From Word, press Alt + F8 to open the macro dialog box.
- Select ClearClipBoard
- Click Run. (The clipboard will be cleared)
|
Sample File:
|
Clear Clipboard.zip 8.29KB
|
Approved by mdmackillop
|
This entry has been viewed 101 times.
|
|