Hello everyone,
I'm afraid I'm again in need of your help...
I have a UserForm with 2 large textbox (because many lines are copied in it). When user enter the text in each textbox, they click on OK button and it will copy/paste each textbox content one after the other from the cell A2.
Here is the code:
My problem is, on several PCs the code works just fine. However, on some other PC and sometimes, it doesn't work.
The line "MyData#.PutInClipboard" OR "Sheet1.Range("A2").PasteSpecial" is highlighted and I get the following error:
Run-time -2147221040 (800401d0)
DataObject:PutInClipboard OpenClipboard Failed
OR
Run-time error '1001'
PasteSpecial method of Range class failed
And once I'm in the debugger, pressing F5 to resume will work just fine and text is copied/pasted properly. So the code works but some PC don't like it...
I really don't understand because it's really on random PC. But if it happens on a PC, the error will always occur whenever I execute the code.
I tried adding a delay of 1 second before the paste commands "(Application.Wait (Now + #12:00:01 AM#)". It seemed to work but I'm really not a big fan of adding 2 seconds if there is another way to solve the issue.
Also, it seems that the same code works fine if there is only 1 textbox.
May I ask if anyone experienced this or know what could cause this issue?
Thanks in advance for your help.
EDIT:
I tried another document (not from me) using the same copy/paste code and the same issue occurs. Is there a restriction I'm not aware of?
Bookmarks