Reset Clear ClipBoard

YasserKhalil
PlatinumLounger
Posts: 4967
Joined: 31 Aug 2016, 09:02

Re: Reset Clear ClipBoard

Post by YasserKhalil »

I tried Rory's solution and I got an error too at this line (I am using Office 2016 32 Bit)
Call oIA.accDoDefaultAction(vKid)

I have searched a lot and a lot and nothing of any solution cleared the clipboard successfully

YasserKhalil
PlatinumLounger
Posts: 4967
Joined: 31 Aug 2016, 09:02

Re: Reset Clear ClipBoard

Post by YasserKhalil »

I have posted at this link too
https://www.mrexcel.com/forum/excel-que ... ost5228448" onclick="window.open(this.href);return false;

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Reset Clear ClipBoard with La légende du bouton :)

Post by Doc.AElstein »

I have got the last coding suggested by Rory to work in Excel 2007
I had to add the German word, Alle löschen , which is used for the “Clear All” button. ( It is case sensitive so I had to write it exactly )

Code: Select all

            If InStr("Clear All Borrar todo Effacer tout Alle löschen - La légende du bouton:)", oIA.accName(vKid)) Then ' avec moi si vou ple La légende du bouton
Alle löschen
Clear All - Alle löschen - La légende du bouton.JPG : https://imgur.com/fhWy9bg" onclick="window.open(this.href);return false;
Clear All - Alle löschen.JPG
( I don’t have it working in Excel 2003 yet ) Edit - see later I do have it working now
XL 2003 Error.jpg https://imgur.com/IUvS5FH" onclick="window.open(this.href);return false;
XL 2003 Error.jpg https://imgur.com/MZCK4cO" onclick="window.open(this.href);return false;


Alan

I believe it is the Office Clipboard that we are clearing:
Ref
https://www.excelforum.com/excel-progra ... false.html" onclick="window.open(this.href);return false;
You do not have the required permissions to view the files attached to this post.
Last edited by Doc.AElstein on 20 Feb 2019, 11:52, edited 1 time in total.
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Reset Clear ClipBoard

Post by Doc.AElstein »

It seems that for XL 2003 we need to use
"Task Pane"
In place of
"Office Clipboard"

I don’t have the slightest clue what most of the coding is doing, but I fiddled around a bit and got this version to work in Excels 2003, 2007 and 2010
I would be curios to know if it works for any other versions , if anyone has the time and interest to try.
You need to
_copy the entire coding to a new module
_ put anything in the clipboard, such as by highlight anything and copy with Ctrl+c
_ check you see something in it: http://www.eileenslounge.com/viewtopic. ... 49#p246730" onclick="window.open(this.href);return false; , https://imgur.com/vdwgXtT" onclick="window.open(this.href);return false;
_ Run the routine Sub ClearOffPainBouton()
If the routine works for you then something like this
BeforeClearClip.JPG : https://imgur.com/vdwgXtT" onclick="window.open(this.href);return false;
Should change to like
AfterClearClip.JPG : : https://imgur.com/1lb19tA" onclick="window.open(this.href);return false;

Alan

P.s. If you do not have “Clear All” written on your boutton, then you may need to add the text you see, where indicated in the coding.

Coding is here: https://pastebin.com/5bhqBAVx" onclick="window.open(this.href);return false; , and in uploaded text file
You do not have the required permissions to view the files attached to this post.
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Reset Clear ClipBoard

Post by Doc.AElstein »

@Yasser
Just a wild guess, for you to try,
Change
Application.OnTime Now
to
Application.OnTime Now + TimeValue("00:00:01")

Alan
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

YasserKhalil
PlatinumLounger
Posts: 4967
Joined: 31 Aug 2016, 09:02

Re: Reset Clear ClipBoard

Post by YasserKhalil »

I tested your last code and also your suggestion but I got an error 438 at this part

Code: Select all

Call oIA.accDoDefaultAction(vKid)

User avatar
Jay Freedman
Microsoft MVP
Posts: 1347
Joined: 24 May 2013, 15:33
Location: Warminster, PA

Re: Reset Clear ClipBoard

Post by Jay Freedman »

All of this was thoroughly thrashed out in the thread https://answers.microsoft.com/en-us/mso ... 34b7e39482 in 2010.

One of the key points is that if you're looking at the Clipboard pane in an Office program, that's the "Office clipboard", which is separate from the "Windows clipboard". The code that uses OpenClipboard and EmptyClipboard works only on the Windows clipboard. The code that simulates a click on the Clear All button works only on the Office clipboard.

YasserKhalil
PlatinumLounger
Posts: 4967
Joined: 31 Aug 2016, 09:02

Re: Reset Clear ClipBoard

Post by YasserKhalil »

Thanks a lot. Yes you are right and I am focusing on the "Office Clipboard" and it seems that the code that simulates a click on "Clear All" button works for many versions of excel except my version 2016 32 Bit !! That's my deduction till now

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Reset Clear ClipBoard

Post by Doc.AElstein »

Hi Jay
Jay Freedman wrote:All of this .... thrashed out in the thread ...if you're looking at the Clipboard pane in an Office program, that's the "Office clipboard", which is separate from the "Windows clipboard". The code that uses OpenClipboard and EmptyClipboard works only on the Windows clipboard. The code that simulates a click on the Clear All button works only on the Office clipboard.
This is what seems to have been failed to have been realised time and time again, and there are a few unanswered threads like the one you mentioned which were left hanging in the air as not everybody realised the points you make. So in many previous Threads, people were talking at cross purposes half the time (I hit the thread you mentioned a few times yesterday when searching. Unfortunately that thread is closed , so we can’t update them)

The stand as I see it now is that: Yasser wants to clear the Office Clipboard, and as you rightly suggest , he needs the coding to simulate a click on the “Clear All” button ( or the “Borrar todo” button, “Effacer tout” button, “ Alle löschen” button …. Or whatever you see you must add to the code to make sure that it finds the right one for your language version)

The “Clear All” click simulating coding here https://eileenslounge.com/viewtopic.php ... 57#p246838" onclick="window.open(this.href);return false; is now working consistently for me on a number of different machines on Office 2003, Office 2007 and Office 2010. It seems to simulate a click on the “Clear All” or “ Alle löschen” (Office clipboard) button for me.
There are some reports of the original coding from which it came working on the higher Office versions for others also.

The remaining issue is that Yasser can’t get any versions of the “Clear All” click simulating coding to work on his Office 2016. The original coding author, Jaafar Tribak , tried to help him yesterday, https://www.mrexcel.com/forum/excel-que ... ost5229023" onclick="window.open(this.href);return false; , but could not get any further as he, ( Jaafar Tribak ) , does not have access to Office 2016.

Alan
_.___________________________-

P.s. I am still not 100% clear on what everything is

_(i) What’s this?.._
Application.CutCopyMode = False
_.. I have used that a lot: It seems to empty something. Is it emptying the Excel Clipboard?? It prevents me pasting anything I copy in Excel

_(ii) Office Clipboard: I think now we all agree on what that is. We can all Clear it manually, and some of us if we are lucky can clear it with coding, ( that is to say some of us can simulate with coding en cliquant sur le bouton )

_(iii) The Windows Clipboard?? I don’t think I personally have aver “experienced that” . – Where / what is that ? How can I experience it.??
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
HansV
Administrator
Posts: 79675
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Reset Clear ClipBoard

Post by HansV »

Excel has its own clipboard that is used when you copy/cut/paste within one instance of Excel. When you copy a range, the Excel clipboard holds a full copy of the range with all its Excel properties, and you get lots of options when you select Paste Special: paste all, paste values, paste formulas, paste a link, transpose...

The Windows clipboard is used by ALL Windows applications. For example, if you copy some text in Notepad, the copy is placed on the Windows clipboard, and you can paste it in all applications that support pasting text.
Another example is when you select a cell, press F2 and copy the value or formula. This is placed on the Windows clipboard as text.

When you copy a range in Excel, it is also placed on the Windows clipboard as an Excel object, so that you can paste it into other applications: for example Notepad, or MS Paint, or into a reply here. This object does not have all features of the internal Excel copy. For example, if you managed to start a second instance of Excel and selected Paste Special, you'd get fewer options than if you select Paste Special in the same instance of Excel. No paste as link, for one.

Pressing Esc in Excel or executing Application.CutCopyMode = False when a range has been copied (shown by a dashed outline around the range) clears the copy from both the Excel clipboard and the Windows clipboard.
Best wishes,
Hans

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: Reset Clear ClipBoard

Post by Doc.AElstein »

Thanks Hans, That clears that up nicely.
I will have to have a good practice with these things.
:)
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

User avatar
DocAElstein
5StarLounger
Posts: 706
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Reset Clear ClipBoard

Post by DocAElstein »

rory wrote:
18 Feb 2019, 13:56
IIRC for Office 2013 or later, you need to use CommandBars("Office Clipboard") rather than CommandBars("Task Pane")
Hi, Mr Rory.
Since this Thread in 2019, I have used various variations of codings discussed here, across Office (Windows) versions 2003 2007 2010 2013 and 2016, and also over the last day or two I have done a few more experiments and reviews in the light of a more recent similar Thread: https://eileenslounge.com/viewtopic.php?f=27&t=41223.
I am finding consistently that it appears that "Task Pane" is needed for codings to work in Office 2003, whereas so far in all cases the same codings need "Office Clipboard" for Offices 2007 2010 2013 and 2016. I strongly suspect that "Office Clipboard" is needed for newer Office versions also based on the codings that appear to work for others with the newer versions. Is it therefore a reasonable assumption that for 2003 and lower "Task Pane" is needed, whereas "Office Clipboard" for all above?
( Have you noticed that some much smaller codings have appeared in the meantime
https://stackoverflow.com/questions/640 ... 9#64946949
* https://www.mrexcel.com/board/threads/r ... st-5228633
( https://www.excelfox.com/forum/showthre ... #post17966
https://www.excelfox.com/forum/showthre ... #post24879 )
I am not sure where they originated? Possibly Jaafar Tribak * ?
(and edit, BTW the newer small codings work in Word also, the older big ones only work in Excel)
I tried to figure out what these more recent smaller codings were doing and had not a clue, but I remember it causing me to have a strange dream of being in the dark in solitary confinement and trying to play a form of Squash / whack-a-mole with a piece of dried excrement, and a more recent enlightenment suggest I may not have been so far off with my thinking. Perhaps another Layman way of thinking could be trying to cross a river by hopping stones)

_.______________________________-

By the way, in all the codings kicking around, this literal name issue plays a fairly minor role. Its needed to make sure the Offices Clipboard Viewer Pane thing is open/ showing . As an alternative we can use Let Application.DisplayClipboardWindow = True. I am not sure what the relative merits are, although I would have a tendency to go with earlier more fundamental stuff. But I don’t know what is the earlier more fundamental of the two ways here. (I noticed in 2003 sometimes the "Task Pane" brought something else up, so I also did the Let Application.DisplayClipboardWindow = True*** to get over that problem. It does not seem to error if the Offices Clipboard Viewer Pane thing is already open, so maybe it does no harm to include it also as a belt and braces approach)
I suppose perhaps needing the thing open for the meat of the codings to work means the COM wrapper of accessiblies interface we are using is only for active accessiblies :innocent:

( *** Edit: Note: Let Application.DisplayClipboardWindow = True works in Excel, not Word )
_._______________________________________-

* @Yasser
Hello Yasser,
I think it could be a good and nice idea for you to do a follow up post over at mrexcel in your February 18, 2019 thread , to tell your Arab friend , Jaafar Tribak, about your more recent post here at eileenslounge .
Jaafar Tribak tried to get you a solution back then, but did not manage it. You seem to have that solution now, ( the one Hans found for you )
It is interesting that one of Jaafar Tribak's attempts for you, was close *
Perhaps Jaafar Tribak might have some interesting comments.
( I note that back in February 2019, Jaafar said he only had Office 2013 so for that reason could not help you further, but it appears now that he has Office 2016




_.________________________________

( One other very minor thing, a small oddity, while I am here, just for completeness. In the review I done of the two similar Threads over the past couple of days, I came across a strange thing. In this thread, (the one we are in now), there was a very monstrous big code offering , ( given from Yasser in a uploaded text file , and I reproduced it here with my usual modifications which usually allow _(i) the thing to work also in Office 2003, as well as _(ii) to work in German Office.)
I can only get that to work in the only English Office versions I have, ( Office 2007). I suspect that coding would also work in at least Office 2003, but my usual modification of changing a literal text in the coding of "Clear All" to "Alle löschen" does not seem to help for that particular monster very big coding. This modification gets all the more typical earlier big Jaafar Tribak codings to work in my German Office, at least for all the Versions that they work in in English Office. )



Alan
Arnold: How did I get in here?
Taxi driver: The door opened, you got in.