PC Review


Reply
Thread Tools Rate Thread

Clear Office Clipboard from VBA?

 
 
=?Utf-8?B?dGhlTHVnZ2FnZQ==?=
Guest
Posts: n/a
 
      24th Apr 2007
I found some code on the web to manipulate the Windows clipboard using
windows API calls.

Is there a way to manipulate the MS Office clipboard?

Here's the scenario. I've got some code that parses through a Word document
and copies all the tables and images from the Word document into an Excel
Workbook. The tables all work fine, but the images are sometimes duplicated.
Instead of getting image 1 and then image 2, I get two copies of image 1.

Even though I clear the clipboard (using the Windows API calls) before I
copy the figure, sometimes I still get the duplicate.

I ran my code with the Office clipboard command bar showing and it looks
like the Office clipboard doesn't get cleared at all. To show the Office
clipboard, I'm just choosing View-->Toolbars-->Clipboard.

Is there a way to clear the Office clipboard?

Thanks in advance for the help!

(Forgive the cross-post. I'm not sure where to post the question.)
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmF5?=
Guest
Posts: n/a
 
      24th Apr 2007
Hi theLuggage -

Check out this site. Chip Pearson provides crystal-clear instructions for
clearing the clipboard with VBA code.

http://www.cpearson.com/excel/clipboard.htm

---
Jay

"theLuggage" wrote:

> I found some code on the web to manipulate the Windows clipboard using
> windows API calls.
>
> Is there a way to manipulate the MS Office clipboard?
>
> Here's the scenario. I've got some code that parses through a Word document
> and copies all the tables and images from the Word document into an Excel
> Workbook. The tables all work fine, but the images are sometimes duplicated.
> Instead of getting image 1 and then image 2, I get two copies of image 1.
>
> Even though I clear the clipboard (using the Windows API calls) before I
> copy the figure, sometimes I still get the duplicate.
>
> I ran my code with the Office clipboard command bar showing and it looks
> like the Office clipboard doesn't get cleared at all. To show the Office
> clipboard, I'm just choosing View-->Toolbars-->Clipboard.
>
> Is there a way to clear the Office clipboard?
>
> Thanks in advance for the help!
>
> (Forgive the cross-post. I'm not sure where to post the question.)

 
Reply With Quote
 
Karl E. Peterson
Guest
Posts: n/a
 
      24th Apr 2007
That's the Windows clipboard, not the Office one, no? I'm not aware of methods to
access the Office clipboard from VBA, but would love to learn that isn't because
it's impossible!
--
..NET: It's About Trust!
http://vfred.mvps.org


Jay <(E-Mail Removed)> wrote:
> Hi theLuggage -
>
> Check out this site. Chip Pearson provides crystal-clear instructions for
> clearing the clipboard with VBA code.
>
> http://www.cpearson.com/excel/clipboard.htm
>
> ---
> Jay
>
> "theLuggage" wrote:
>
>> I found some code on the web to manipulate the Windows clipboard using
>> windows API calls.
>>
>> Is there a way to manipulate the MS Office clipboard?
>>
>> Here's the scenario. I've got some code that parses through a Word document
>> and copies all the tables and images from the Word document into an Excel
>> Workbook. The tables all work fine, but the images are sometimes duplicated.
>> Instead of getting image 1 and then image 2, I get two copies of image 1.
>>
>> Even though I clear the clipboard (using the Windows API calls) before I
>> copy the figure, sometimes I still get the duplicate.
>>
>> I ran my code with the Office clipboard command bar showing and it looks
>> like the Office clipboard doesn't get cleared at all. To show the Office
>> clipboard, I'm just choosing View-->Toolbars-->Clipboard.
>>
>> Is there a way to clear the Office clipboard?
>>
>> Thanks in advance for the help!
>>
>> (Forgive the cross-post. I'm not sure where to post the question.)




 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      24th Apr 2007
There is more than one clipboard???

"theLuggage" wrote:

> I found some code on the web to manipulate the Windows clipboard using
> windows API calls.
>
> Is there a way to manipulate the MS Office clipboard?
>
> Here's the scenario. I've got some code that parses through a Word document
> and copies all the tables and images from the Word document into an Excel
> Workbook. The tables all work fine, but the images are sometimes duplicated.
> Instead of getting image 1 and then image 2, I get two copies of image 1.
>
> Even though I clear the clipboard (using the Windows API calls) before I
> copy the figure, sometimes I still get the duplicate.
>
> I ran my code with the Office clipboard command bar showing and it looks
> like the Office clipboard doesn't get cleared at all. To show the Office
> clipboard, I'm just choosing View-->Toolbars-->Clipboard.
>
> Is there a way to clear the Office clipboard?
>
> Thanks in advance for the help!
>
> (Forgive the cross-post. I'm not sure where to post the question.)

 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      24th Apr 2007
You can access the Office Clipboard Edit>OfficeClipboard in Excel. It should
show what is on it, if anything, from whatever source. You can then edit it
one item at a time or all at once. See Excel help on Clipboard.

"theLuggage" wrote:

> I found some code on the web to manipulate the Windows clipboard using
> windows API calls.
>
> Is there a way to manipulate the MS Office clipboard?
>
> Here's the scenario. I've got some code that parses through a Word document
> and copies all the tables and images from the Word document into an Excel
> Workbook. The tables all work fine, but the images are sometimes duplicated.
> Instead of getting image 1 and then image 2, I get two copies of image 1.
>
> Even though I clear the clipboard (using the Windows API calls) before I
> copy the figure, sometimes I still get the duplicate.
>
> I ran my code with the Office clipboard command bar showing and it looks
> like the Office clipboard doesn't get cleared at all. To show the Office
> clipboard, I'm just choosing View-->Toolbars-->Clipboard.
>
> Is there a way to clear the Office clipboard?
>
> Thanks in advance for the help!
>
> (Forgive the cross-post. I'm not sure where to post the question.)

 
Reply With Quote
 
=?Utf-8?B?dGhlTHVnZ2FnZQ==?=
Guest
Posts: n/a
 
      24th Apr 2007

I am using the Windows API calls exactly from the cpearson web site. That's
where I got the code to begin with. (But thanks for the pointer anyway.)

That's not solving the problem, though. As I mentioned, it appears that
Office has it's own clipboard implementation.

"Jay" wrote:

> Hi theLuggage -
>
> Check out this site. Chip Pearson provides crystal-clear instructions for
> clearing the clipboard with VBA code.
>
> http://www.cpearson.com/excel/clipboard.htm
>
> ---
> Jay
>
> "theLuggage" wrote:
>
> > I found some code on the web to manipulate the Windows clipboard using
> > windows API calls.
> >
> > Is there a way to manipulate the MS Office clipboard?
> >
> > Here's the scenario. I've got some code that parses through a Word document
> > and copies all the tables and images from the Word document into an Excel
> > Workbook. The tables all work fine, but the images are sometimes duplicated.
> > Instead of getting image 1 and then image 2, I get two copies of image 1.
> >
> > Even though I clear the clipboard (using the Windows API calls) before I
> > copy the figure, sometimes I still get the duplicate.
> >
> > I ran my code with the Office clipboard command bar showing and it looks
> > like the Office clipboard doesn't get cleared at all. To show the Office
> > clipboard, I'm just choosing View-->Toolbars-->Clipboard.
> >
> > Is there a way to clear the Office clipboard?
> >
> > Thanks in advance for the help!
> >
> > (Forgive the cross-post. I'm not sure where to post the question.)

 
Reply With Quote
 
=?Utf-8?B?dGhlTHVnZ2FnZQ==?=
Guest
Posts: n/a
 
      24th Apr 2007

I meant to say this in my original post: we're using Office 2000 for
Windows. There is no Edit-->OfficeClipboard in Office 2k that I can see.

In any case, I need to do this in VBA code, not via a UI.

"JLGWhiz" wrote:

> You can access the Office Clipboard Edit>OfficeClipboard in Excel. It should
> show what is on it, if anything, from whatever source. You can then edit it
> one item at a time or all at once. See Excel help on Clipboard.
>
> "theLuggage" wrote:
>
> > I found some code on the web to manipulate the Windows clipboard using
> > windows API calls.
> >
> > Is there a way to manipulate the MS Office clipboard?
> >
> > Here's the scenario. I've got some code that parses through a Word document
> > and copies all the tables and images from the Word document into an Excel
> > Workbook. The tables all work fine, but the images are sometimes duplicated.
> > Instead of getting image 1 and then image 2, I get two copies of image 1.
> >
> > Even though I clear the clipboard (using the Windows API calls) before I
> > copy the figure, sometimes I still get the duplicate.
> >
> > I ran my code with the Office clipboard command bar showing and it looks
> > like the Office clipboard doesn't get cleared at all. To show the Office
> > clipboard, I'm just choosing View-->Toolbars-->Clipboard.
> >
> > Is there a way to clear the Office clipboard?
> >
> > Thanks in advance for the help!
> >
> > (Forgive the cross-post. I'm not sure where to post the question.)

 
Reply With Quote
 
=?Utf-8?B?dGhlTHVnZ2FnZQ==?=
Guest
Posts: n/a
 
      24th Apr 2007

Also, Chip's method only works for text. I'm having problems with Images.

Thanks again for the help. I really do appreciate it.


"Jay" wrote:

> Hi theLuggage -
>
> Check out this site. Chip Pearson provides crystal-clear instructions for
> clearing the clipboard with VBA code.
>
> http://www.cpearson.com/excel/clipboard.htm
>
> ---
> Jay
>
> "theLuggage" wrote:
>
> > I found some code on the web to manipulate the Windows clipboard using
> > windows API calls.
> >
> > Is there a way to manipulate the MS Office clipboard?
> >
> > Here's the scenario. I've got some code that parses through a Word document
> > and copies all the tables and images from the Word document into an Excel
> > Workbook. The tables all work fine, but the images are sometimes duplicated.
> > Instead of getting image 1 and then image 2, I get two copies of image 1.
> >
> > Even though I clear the clipboard (using the Windows API calls) before I
> > copy the figure, sometimes I still get the duplicate.
> >
> > I ran my code with the Office clipboard command bar showing and it looks
> > like the Office clipboard doesn't get cleared at all. To show the Office
> > clipboard, I'm just choosing View-->Toolbars-->Clipboard.
> >
> > Is there a way to clear the Office clipboard?
> >
> > Thanks in advance for the help!
> >
> > (Forgive the cross-post. I'm not sure where to post the question.)

 
Reply With Quote
 
Karl E. Peterson
Guest
Posts: n/a
 
      24th Apr 2007
theLuggage <(E-Mail Removed)> wrote:
> Also, Chip's method only works for text. I'm having problems with Images.


EmptyClipboard truly empties the clipboard of _all_ formats -- text, images,
metafiles, younameit. But, as you found, that's the *Windows* clipboard, not this
hybrid "thing" offered by Office.
--
..NET: It's About Trust!
http://vfred.mvps.org


 
Reply With Quote
 
Tony Jollans
Guest
Posts: n/a
 
      24th Apr 2007
If you are using Office 2000 you do have some indirect access to the Office
Clipboard from VBA - but you do not have it in any later versions.

In Office 2000 the Office Clipboard is presented as a CommandBar and so you
can programmatically manipulate the Controls, for example ...

CommandBars("Clipboard").Controls("Clear Clipboard").Execute

In Office XP and later, the Office Clipboard is presented as a Task Pane and
the 'back door' has been shut. AFAIK, VBA access to it post-2000 is
impossible - I don't think you can even do it with SendKeys (but don't quote
me on that).

--
Enjoy,

Tony Jollans
Microsoft Word MVP

"theLuggage" <(E-Mail Removed)> wrote in message
news:32D2067A-7B8C-4640-8F66-(E-Mail Removed)...
>
> I meant to say this in my original post: we're using Office 2000 for
> Windows. There is no Edit-->OfficeClipboard in Office 2k that I can see.
>
> In any case, I need to do this in VBA code, not via a UI.
>
> "JLGWhiz" wrote:
>
>> You can access the Office Clipboard Edit>OfficeClipboard in Excel. It
>> should
>> show what is on it, if anything, from whatever source. You can then edit
>> it
>> one item at a time or all at once. See Excel help on Clipboard.
>>
>> "theLuggage" wrote:
>>
>> > I found some code on the web to manipulate the Windows clipboard using
>> > windows API calls.
>> >
>> > Is there a way to manipulate the MS Office clipboard?
>> >
>> > Here's the scenario. I've got some code that parses through a Word
>> > document
>> > and copies all the tables and images from the Word document into an
>> > Excel
>> > Workbook. The tables all work fine, but the images are sometimes
>> > duplicated.
>> > Instead of getting image 1 and then image 2, I get two copies of image
>> > 1.
>> >
>> > Even though I clear the clipboard (using the Windows API calls) before
>> > I
>> > copy the figure, sometimes I still get the duplicate.
>> >
>> > I ran my code with the Office clipboard command bar showing and it
>> > looks
>> > like the Office clipboard doesn't get cleared at all. To show the
>> > Office
>> > clipboard, I'm just choosing View-->Toolbars-->Clipboard.
>> >
>> > Is there a way to clear the Office clipboard?
>> >
>> > Thanks in advance for the help!
>> >
>> > (Forgive the cross-post. I'm not sure where to post the question.)



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer clipboard from Task pane clipboard(office?) content to Excel (windows?) clipboard? tskogstrom Microsoft Excel Programming 2 6th Mar 2007 12:50 PM
I am asked to clear clipboard,yet there is no data to clear-help! =?Utf-8?B?UEogTycgTGVhcnk=?= Microsoft Excel Crashes 1 15th Apr 2006 12:30 PM
Clear and control the Office clipboard in Excel =?Utf-8?B?cXVhcnR6?= Microsoft Excel Programming 0 22nd Feb 2005 08:33 PM
cannot clear clipboard when clipboard appears empty =?Utf-8?B?U2hhbmk=?= Microsoft Excel Misc 1 4th Nov 2004 02:58 AM
Office Clipboard: Clear all with VBA-macro? wonder Microsoft Excel Programming 0 18th Dec 2003 09:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:35 PM.