Clearing Clipboard with VBA Impossible?

A

Angie M.

Hello,

When searching for a way to clear the clipboard in Word 2003, we found
Jonathan West's suggestion of using
"CommandBars.FindControl(ID:=3634).Execute", however we can't get it to work
(maybe it works but we are missing a piece of the puzzle).

Any suggestions or ideas? We're ready to give up.

Thanks for your time.
 
D

Doug Robbins - Word MVP

I am not sure from where you got that. In Jonathon's article at
http://www.word.mvps.org/FAQs/MacrosVBA/ManipulateClipboard.htm, it states:

This is how to clear the clipboard in VBA:
Dim MyData As DataObject

Set MyData = New DataObject
MyData.SetText ""
MyData.PutInClipboard


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Sammy

Thanks, we just tried this. It works with Word 97 but not Word 2003. Any
ideas for clearing the clipboard in 2003?

Thanks again
 
O

old man

Hi,

I use this to clear the clipboard in Word 2003.

Add these three API declerations at the top of your module:
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As
Long


this routine will do it:
Sub ClearClipboard()

OpenClipboard 0&
EmptyClipboard
CloseClipboard

end sub

What you may mean is that its very difficult to clear the Office Clipboard.

Old Man
 
S

Sammy

THANK YOU ALL, YOUR TIME IS APPRECIATED

old man said:
Hi,

I use this to clear the clipboard in Word 2003.

Add these three API declerations at the top of your module:
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As
Long


this routine will do it:
Sub ClearClipboard()

OpenClipboard 0&
EmptyClipboard
CloseClipboard

end sub

What you may mean is that its very difficult to clear the Office Clipboard.

Old Man
 

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