cancel
Showing results for 
Search instead for 
Did you mean: 

MS Excel VBO

CR
Level 4
I get this error trying to use Paste function with MS Excel VBO. I do a control c and have data in the clip board which I see when I use control v to copy to notepad. Any ideas about issue.  : Failed to paste from clipboard: PasteSpecial method of Range class failed
8 REPLIES 8

Joshi_KumarA_V
Level 3
Attach your workflow to better investigate. But, apparently i believe there is nothing in the clipboard to paste that throws this error.  One way to check this is to check your clipboard if anything exists or if its empty before proceeding to paste.  https://www.codeproject.com/Questions/1089557/Check-with-Csharp-if-the-… Thanks, Joshi

CR
Level 4
I can pick up what is on the clip board by doing a control v in notepad and see information there. For some reason my open workbook does not open up excel and am wondering if that is the issue. I don't see excel launched on my desktop with the open workbook function. Using surface automation to read through a table and copy to the clipboard and paste into excel. Thanks

Open workbook does not show by default, we have had some issues where data does not get pasted into excel without using the 'Show"" function in the Excel VBO. this fixed our issue so give that a try   Hope this helps Cheers

Anna_BlytheHewi
Level 2
I am having a similar issue. I am using global send keys to copy something from a screen and then want to use the paste function into excel. It looks like I am not appropriately copying to the clipboard but when I paste normally (outside of BP) it works fine. Do you have any other suggestions?

Anna_BlytheHewi
Level 2
Update: In excel when I open the clipboard it shows that my data is there but I still get the error "" Failed to paste from clipboard: PasteSpecial method of Range class failed"". Is there something that can work around this issue?

AndreyKudinov
Level 10
What Paste action does is: to the current selection, paste special range with skip blanks off and transpose off, either just values or all. Problem seems to be is that what you have in clipboard is not a ""range"" and then when you try to do paste special in excel, you'll see a different options. If it is just a text, you can probably just write it to a cell.  

Neel1
MVP
I tried using the Paste action after setting one word only in cipboard but still it failed with error:  : Failed to paste from clipboard: PasteSpecial method of Range class failed

AndreyKudinov
Level 10
If you copy a cell or range - it should paste fine, but not simple text. You can only PasteSpecial ranges with Transpose:=False. To fix this, you can change MS Excel VBO, Paste, Paste Values code stage: This line: range.PasteSpecial(Paste:=Paste_Option, Operation:=-4142, SkipBlanks:=False, Transpose:=False) Change like this: range.PasteSpecial(Paste:=Paste_Option, Operation:=-4142) Both SkipBlanks and Transpose are false by default anyway, so it should not change anything working now, but it will start working in some cases it failed before.  MSDN: https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel.range.pastespecial?view=excel-pia. Make a copy of this page if unsure.