Excel VBO - Paste - Failed to paste from Clipboard
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
21-09-16 06:06 PM
Hey,
I'm trying to paste a table in Excel I've exported from a Citrix client to my clipboard. Pasting manually works fine in Excel, but it doesn't work using Excel VBO - Paste page.
My logic for pasting is the following:
- Export the table to my clipboard from Citrix client
----------------------------
Excel VBO
----------------------------
- Create Instance
- Show
- Create Workbook
- Paste
However, when I reach Paste stage, I get the following error message: " : Failed to paste from clipboard: PasteSpecial method of Range class failed"
Does anyone what that means, and how I can fix this problem?
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
22-09-16 03:33 PM
I guess the Paste action only works if you copy a range of cells in one Excel sheet and want to paste it somewhere else. To achieve what you are trying to, I would move to a cell and send Ctrl + V using send keys. You are going to have to make sure Excel window is active.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-09-16 01:04 PM
Thanks for a response, radoslav.hiko!
Doesn't that mean that I have to use Surface Automation to achieve this? By Surface Automation, I mean that you have to capture the region of Excel, select cell A1, and then use global send keys. I have thought of that solution, but wanted to make sure Pasted in Excel VBO worked first.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-09-16 02:27 PM
No, you do not need surface automation. There is an action in MS Excel VBO called Go To Cell. You can use that action to set the active cell such as A1.
You will have to create a new Windows based object though and spy the Excel window to be able to activate it and send Ctrl + V.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-09-16 06:03 PM
Oh, thanks! I didn't realize the ""Go To Cell"" action. I'm currently using ""Set Cell"" action, which will set the active cell to whatever I define.
Then I've created a new WIN32 based object. However, it is not possible to identify the whole window. Only menu, the excel worksheet, and some obstacles on the side. Do you why this is happening? I'm currently spying the excel sheet, which works somehow. However, if Excel gets minimized, I will not be able to activate it. I can only activate the sheet if Excel window is behind other windows.
How can I spy the whole application window?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-09-16 01:43 PM
Yes, it is quite impossible to spy the whole window. I was able to do so only by using Active Accessibility and hovering with mouse over the top right corner of the window.
As far as I know, a minimized window can never be activated, this is common to all applications, nothing specific to Excel.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
27-09-16 06:38 PM
Ok, I didn't know that you can never activate minimized windows! I'm going to test it out. I use Win32 to spy the worksheet, and as long as Excel is not minimized, I'm able to activate Excel and paste my content into the worksheet!
