Clearing the Clipboard

J

Jim Dahlstrom

Thanks to all that respond.

Using VBA - Word 2002 / Office XP / Windows 2000

Some of my routines result in multiple, fairly large
entries in the Clipboard. I want to clear the Clipboard
of all entries. How can I do that?

I have been to
http://word.mvps.org/FAQs/MacrosVBA/ManipulateClipboard.htm
, have a user form defined, and "Microsoft Forms 2.0
Object Library" is set in the references. When I run the
code;

Dim MyData As DataObject

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

the routine is stepped through, but nothing is cleared.

What am I missing??

Thanks,
Jim D.
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Jim Dahlstrom > écrivait :
In this message, < Jim Dahlstrom > wrote:

|| Thanks to all that respond.
||
|| Using VBA - Word 2002 / Office XP / Windows 2000
||
|| Some of my routines result in multiple, fairly large
|| entries in the Clipboard. I want to clear the Clipboard
|| of all entries. How can I do that?

If you are talking about multiple entries in the clipboard, then you are
surely referring to the Office clipboard, not the Windows clipboard. The
information you got from
http://word.mvps.org/FAQs/MacrosVBA/ManipulateClipboard.htm
refers to the Windows clipboard.

The Office clipboard is a different beast, and unfortunately, according to
the Knowledge Base article at
http://support.microsoft.com/default.aspx?scid=kb;en-us;221190, in Word
2000,
"There is no Visual Basic for Applications object model for the Office
Clipboard, so there is no way to programmatically manipulate it."

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jim Dahlstrom

Thanks Jean-Guy

Just need to find a different way to move text from one
document to another, with para style defn / font format
variations / bookmarks / multiple paragraphs / tables,
without loading up the clipboard.

Is there a way?

Thanks for your help.

Regards,
Jim D.
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Jim Dahlstrom > écrivait :
In this message, < Jim Dahlstrom > wrote:

| Thanks Jean-Guy
|
| Just need to find a different way to move text from one
| document to another, with para style defn / font format
| variations / bookmarks / multiple paragraphs / tables,
| without loading up the clipboard.
|
| Is there a way?
|

Play around with the following code, maybe you will find joy?

'_______________________________________
Dim MyRange As Range

Set MyRange = Selection.Range

ActiveDocument.Content.Select
Selection.Collapse wdCollapseEnd

Selection.Range.FormattedText = MyRange
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
S

Steve Lang

Hi Jim,

There is also something called the "Spike" (using the method AppendToSpike)
that may be useful. It is actually part of the Autotext entries of the
Normal template. Using it you can collect multiple "Clips" of formatted
text, then put them all out on a new document. Note that this removes the
text from it's original location, much like Cut.

Just a thought.

HTH and have a great day!

Steve

Thanks Jean-Guy

Just need to find a different way to move text from one
document to another, with para style defn / font format
variations / bookmarks / multiple paragraphs / tables,
without loading up the clipboard.

Is there a way?

Thanks for your help.

Regards,
Jim D.
 
J

Jing You

hi everyone,

I have been puzzled by this question for a long time. Now I know the
clipboard of office and clipboard of windows are really different things, so
you can not clear the clipboard by Win32 SDK api: OpenClipboard,
EmptyClipboard, and CloseClipboard.

But there is another idea about how to clear clipboard.We know we can use
CommandBars object to find a menu item of word and then execute it, so why
don't we find out the menu command of clear clipboard. Unfortunately, only
the menu item "Show Clipboard" was found in menu "Edit". The function
clearing office clipboard just is provided as a button on Clipboard window
of Word. Does anyone else know how can we find the menu item "clear
clipboard"??

Best Regards
Jing You

"Jim Dahlstrom" <[email protected]>
Thanks Jean-Guy

Just need to find a different way to move text from one
document to another, with para style defn / font format
variations / bookmarks / multiple paragraphs / tables,
without loading up the clipboard.

Is there a way?

Thanks for your help.

Regards,
Jim D.
 

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