Reset Clear ClipBoard

YasserKhalil
PlatinumLounger
Posts: 4936
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: 4936
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: 4936
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: 1321
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: 4936
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: 78959
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