Link to home
Start Free TrialLog in
Avatar of Robert Berke
Robert BerkeFlag for United States of America

asked on

Can't copy text from vba to an Excel Worksheet due to a bug in Office Clipboard.

I sometimes get into a mode where I cannot copy text from a vba program into some cells in my worksheet

When I use ctrl c to copy then ctrl v to paste, an older clipboard entry was pasted.  (I was very confused at first, but I eventually figured out there was a problem with the office clipboard.

This problem used to happen once every several months, but lately, it has been happening every few days.

For instance the Office Clipboard looked like this:
 User generated image
I can click on the lower entries and they paste fine. But, when I click on the first entry, nothing happens.

If I close Excel, the reopen it, everything is back to normal for a while.

I will eventually try fixing this with  an Office repair, but right now I just want to know if anybody else is having this problem ?
Avatar of Norie
Norie

Where exactly are you copying to/from?
I have not experienced this problem.  But, when I copy code I paste in Notepad to clear any extraneous characters.  Then, I paste in a program where I can track good code.   For example, an invisible carriage return in your code from vba could make it look like nothing showed up in Excel,  but the code may be there.  you would need to use word wrap or expand the row height to be certain.
Avatar of Robert Berke

ASKER

That absolutely did not help in this situation.
richard: That absolutely did not help in this situation.

Norie: Please view the ee-demo.jpg in my first post.  The first item on the office clipboard shows the actual text.  I was editting a vba program and selected about 10 lines of code and then did a control c.  The destination was any cell in the spreadsheet.
what happens when you start excel in safe mode.
To fully answer your question about safe mode I would need to run excel exclusively in safe mode for several days which is not practical for me.
But, I know that closing Excel and reopening it temporarily fixes the problem but only for a few days.
 
Nonetheless, something is causing excel to get corrupted, and there is at least a 50/50 chance that my macros are the culprit (( use them hundreds of times each day).  

I will leave this question open for two days and see if any other experts have helpful suggestions.  
But I will continue to troubleshoot this random problem for the next several weeks.

In case anybody is interested, here I what I intend to do.  Feel free to suggest additional points.

* I will start rebooting every night and see if the problem behavior goes away. If it stays "fixed" for several weeks, I will return to my normal behavior of rebooting just once every few weeks and see if the problem returns.

Assuming the problem returns and ctrl v pastes "old contents" I will document the heck out of it:
* I will immediately get a screen shot of the office clipboard and I'll make a note of what I was doing before the anomaly .
* I will mark the event on my calendar to get more accurate data of how often it happens.
* I will then copy new text from a Notepad file and see if Excel Ctrl V still pastes the "old text"
* I will specifically look at the screen shot and see if "paste all" is gray shaded.  I have a hunch that it might be related to this problem.
* I will open a 2nd instance of excel and verify that it will correctly paste "new text". I will close that 2nd instance quickly to avoid confusion.
* I will open MS Word and verify that it also behaves correctly and pastes "new text".
* I will return to 1st instance of excel and close all open workbooks and see if the behavior improves. (Of course I will need to open a new workbook to do this test.)
* I will use  the vba immediate window and issue a vba "end" command to see if behavior improves
* I  issue <thisworkbook.close> commands until every addin is  closed and see if the behavior improves.
* I will click on the "clear all" in the Office Clipboard dialog and see if the behavior improves.
* if none of the above fixes the 1st instance of excel, I might still leave it open for a while and try to think of something more to document.
* Eventually, I will close the 1st instance of Excel and resume my normal work.  

After the above has happened several times, I will run an Excel repair and see if that improves the situation.
ASKER CERTIFIED SOLUTION
Avatar of Robert Berke
Robert Berke
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial