From: NickHK on 24 Apr 2007 22:15 Due to various annoying "features" of Office clipboard, I disabled it long ago. http://support.microsoft.com/kb/207438 That way you only have to deal with the Windows clipboard. As it can only have a single object in each format, copying another picture <in the same format> will clear the previous one. And as others have pointed out, AFAIK there is no VBA access to the Office clipboard. The DataObject only lets you work with text. NickHK "theLuggage" <theLuggage(a)nospam.nospam> wrote in message news:B930FEFF-69A0-4E8D-B380-1ED82DC3CEFD(a)microsoft.com... > 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: Jonathan West on 25 Apr 2007 04:49 "theLuggage" <theLuggage(a)nospam.nospam> wrote in message news:B930FEFF-69A0-4E8D-B380-1ED82DC3CEFD(a)microsoft.com... >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.) There isn't a direct way to clear the set of Office clipboards in VBA, but what you can to is execute the button on the Clipboard toolbar that achieves this. A bit of experimentation shows that the button's ID code is 3634, so the following line of code will do the trick CommandBars.FindControl(ID:=3634).Execute -- Regards Jonathan West - Word MVP www.intelligentdocuments.co.uk Please reply to the newsgroup Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
From: "Tony Jollans" My forename at my surname dot on 25 Apr 2007 05:34 I just went back and re-read the original post and the problem really should have nothing to do with the Office Clipboard. Loosely, what happens is this: when you do a Copy operation the Windows Clipboard is cleared and whatever it is you are copying is placed in the Windows Clipboard. It may be added in several different formats (it's not really relavant now, but some of them may go onto the clipboard itself, some of them may be pointers for the originating application to act on later request). When you do a Paste, the Windows Clipboard is asked to provide whatever is on it in the format you want and, providing that format is available, it will provide it, but still maintain whatever it holds for you to do further Pastes if you wish. In normal circumstances you should not need to do an explicit emptying of the clipboard yourself. Separate to all this there is, again (very) loosely, a Windows event fired when something is added to the Windows Clipboard which allows Office to know that it has happened and take a copy for the Office Clipboard. Entirely separate from the Windows Clipboard, the Office Clipboard maintains its own copies of up to 12 (Office 2000) or 24 (later versions) items. Office provides some UI facilities for manipulating the copies it holds but they are not directly available from code and no Paste operation, other than explicitly from the Office Clipboard, will use them. If you do do an explicit Paste from the Office Clipboard (via the UI) what actually happens is that a (Windows) Copy operation is triggered to copy from the Office Clipboard to the Windows Clipboard and a (Windows) Paste operation is then triggered to paste from the Windows Clipboard to the specified destination. I confess myself at a total loss to explain how something that has been removed from the Windows Clipboard can later be Pasted; it can only happen if it has be re-placed (i.e. re-copied) on to the Windows Clipboard again - whether explicitly or implicitly as part of some other operation. So the immediate questions must be: can you verify that your copies have worked? can you verify that your clearing of the Windows clipboard has worked? and what do you do between copying and pasting? -- Enjoy, Tony Jollans Microsoft Word MVP "Tony Jollans" <My forename at my surname dot com> wrote in message news:O4e$vXrhHHA.4976(a)TK2MSFTNGP03.phx.gbl... > 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.) > >
From: NickHK on 25 Apr 2007 05:56 Tony's is probably one of the most coherent you will find on the inner workings of the Office clipboard. There is the Windows app "Clipboard Viewer", on my Win2K at C:\WINNT\system32\clipbrd.exe, that you can use see what is actually being copied to the windows clipboard. See if your .Copy's are what you expect. NickHK "Tony Jollans" <My forename at my surname dot com> wrote in message news:emaG%23zxhHHA.3472(a)TK2MSFTNGP04.phx.gbl... > I just went back and re-read the original post and the problem really should > have nothing to do with the Office Clipboard. > > Loosely, what happens is this: when you do a Copy operation the Windows > Clipboard is cleared and whatever it is you are copying is placed in the > Windows Clipboard. It may be added in several different formats (it's not > really relavant now, but some of them may go onto the clipboard itself, some > of them may be pointers for the originating application to act on later > request). When you do a Paste, the Windows Clipboard is asked to provide > whatever is on it in the format you want and, providing that format is > available, it will provide it, but still maintain whatever it holds for you > to do further Pastes if you wish. In normal circumstances you should not > need to do an explicit emptying of the clipboard yourself. > > Separate to all this there is, again (very) loosely, a Windows event fired > when something is added to the Windows Clipboard which allows Office to know > that it has happened and take a copy for the Office Clipboard. Entirely > separate from the Windows Clipboard, the Office Clipboard maintains its own > copies of up to 12 (Office 2000) or 24 (later versions) items. Office > provides some UI facilities for manipulating the copies it holds but they > are not directly available from code and no Paste operation, other than > explicitly from the Office Clipboard, will use them. If you do do an > explicit Paste from the Office Clipboard (via the UI) what actually happens > is that a (Windows) Copy operation is triggered to copy from the Office > Clipboard to the Windows Clipboard and a (Windows) Paste operation is then > triggered to paste from the Windows Clipboard to the specified destination. > > I confess myself at a total loss to explain how something that has been > removed from the Windows Clipboard can later be Pasted; it can only happen > if it has be re-placed (i.e. re-copied) on to the Windows Clipboard again - > whether explicitly or implicitly as part of some other operation. So the > immediate questions must be: can you verify that your copies have worked? > can you verify that your clearing of the Windows clipboard has worked? and > what do you do between copying and pasting? > > -- > Enjoy, > > Tony Jollans > Microsoft Word MVP > > "Tony Jollans" <My forename at my surname dot com> wrote in message > news:O4e$vXrhHHA.4976(a)TK2MSFTNGP03.phx.gbl... > > 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.) > > > > > >
From: theLuggage on 25 Apr 2007 09:46 Thank you Karl, Tony, Nick and Jonathan. I'll give your various suggestions a try at let you know the results. "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.)
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Multiple Users Not Saving Data to a Form Template Next: Tab problem |