From: theLuggage on

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.)
From: theLuggage on

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.)
From: theLuggage on

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.)
From: Karl E. Peterson on
theLuggage <theLuggage(a)nospam.nospam> 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


From: "Tony Jollans" My forename at my surname dot on
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" <theLuggage(a)nospam.nospam> wrote in message
news:32D2067A-7B8C-4640-8F66-E532CB17E42B(a)microsoft.com...
>
> 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.)