1

When I copy something, and quit the software (excel or word, and perhaps others) I have an alert, asking me if I want to keep or delete the content of the clipboard, because it is too big. Time after time this modal alert annoys me, is this a way to disable it?

Because, if I copy something in the clipboard, YES I want it to remain in the clipboard.

Ramhound
  • 41,734
  • 35
  • 103
  • 130
FredericP
  • 111
  • 3
  • 2
    Does this answer your question? [How can I avoid the clipboard message box when copying large amounts of data in Excel?](https://superuser.com/questions/382715/how-can-i-avoid-the-clipboard-message-box-when-copying-large-amounts-of-data-in) – feetwet Nov 03 '22 at 19:12

1 Answers1

3

As far as I'm aware there's no way to prevent this warning, because Microsoft doesn't want you to lose your data by accident (e.g. closing Word before pasting some text in another program).

It's just due to the way the Windows Clipboard works. When you copy and paste things, for modern programs the originating application might still interact with the target application when trying to insert something you've copied. That's how you're able to copy text in a web browser and insert it as HTML formatted text in a Word document for example (just the other way around).

While the Windows Clipboard by itself supports a few different media formats, techniques like this allowed developers to expand the possibilities.

If you don't want the warning to appear, just copy and paste your content before closing the program, then copy something tiny (like a word or cell) and you won't get the message. As an alternative, you can open the Clipboard panel (click on the arrow in the bottom right part of the Clipboard section on the Insert ribbon) and delete snippets before closing.

You can automate this using a macro as explained here, although I wouldn't really recommend it, because some time sooner or later you'll lose text or formatting that way you wanted to keep.

'Events: http://msdn.microsoft.com/en-us/library/bb208800.aspx
Sub AutoExit()
    ClearClipboard
End Sub

Sub ClearClipboard()
    Dim MyData As Object
    ' source: http://akihitoyamashiro.com/en/VBA/LateBindingDataObject.htm
    Set MyData = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
    MyData.SetText ""
    MyData.PutInClipboard
    Set MyData = Nothing
End Sub
Mario
  • 4,266
  • 2
  • 22
  • 22
  • 1
    your explanation is great! However the macro just does the opposite what's requested in the question, he needs to keep the content of the clipboard, and not clear it. – Máté Juhász Dec 15 '16 at 09:53
  • @MátéJuhász Not sure about that. To me it sounded as if copying was already done at that point. You can't really have both things, even after manually confirming the operation. – Mario Dec 15 '16 at 16:38
  • I don't understand anything with your answer, sorry! If one don't want me to lose data, then don't ask me to potentially clear the clipboard. I don't understand why html text has to be pasted with the original application opened... If I remember correctly, Windows does work as expected in the past, perhaps this 'feature' has been changed in latest versions of windows (I hope !). And yes, I want the stuff to stay on the clipboard, not disappear, so I can't use your macro. – FredericP Jan 01 '17 at 15:05
  • While word is still open it isn't really HTML text (or any kind of other common format). That's to be determined once Word is notified of another application requesting the keyboard data. I don't think there's any way around the prompt while keeping the data in simplified form in the clipboard – Mario Jan 01 '17 at 21:17