I’m working on a workflow where I take a screenshot and store it in the clipboard using UiPath. The clipboard definitely has the image because when I manually press Ctrl + V, the screenshot pastes correctly.
However, when I try to automate this using the Keyboard Shortcuts activity (Ctrl + V), nothing gets pasted. Instead, it just types the letter v in the target application (Excel in my case).
Here’s what I’ve tried so far:
Verified that the clipboard contains the image.
Used Keyboard Shortcuts with Ctrl checked and key as v.
Tried enabling/disabling Simulate and SendWindowMessages.
Added delays and ensured the target element is active.
Still no luck. Has anyone faced this issue or knows how to reliably paste clipboard content (image) using UiPath?
Any suggestions or best practices would be greatly appreciated!
This happens because Excel doesn’t accept simulated or window-message keystrokes for pasting images.
Activate the Excel window, then paste using Type Into with [k(ctrl)]v[k(ctrl)], keep SimulateType = False and SendWindowMessages = False. This reliably pastes the clipboard image.
1.Activate the Excel window(make sure the target cell is focused).
2. Use Type Into
3. Keep these settings:
SimulateType = False
SendWindowMessages = False
ClickBeforeTyping = True(recommended)
This sends a real keyboard paste event, allowing Excel to correctly paste the clipboard image.
Doing UI Automation (ie clicking and typing) isn’t the correct way to work with Excel files. You should be using the Excel activities.
That being said, inserting images is painful. Sadly, UiPath doesn’t have any out-of-the-box activities for this. There are ways to do it using macros or VBA, and you can search the forum for those solutions.