I need to paste into Excel from an external program them move onto the next line. I have this code so far that works when I manually run it.
Sub Paste_From_External()
ActiveCell.PasteSpecial Paste:=xlPasteValues
ActiveCell.Offset(1).Select
End Sub
My question is how can I have Excel listen for new clipboard data and only paste when new data hits the clipboard?
Try with below code. It will copy the latest clipboard data into excel
Here is rather a crude but effective way of monitoring the clipboard.
Refernce:Get text from clipboard using GetText - avoid error on empty clipboard
You could also hook the ClipBoard event using API calls. Here is an example in VB.Net: Monitoring clipboard for changes. I was able to get the callback but could not get the data to paste.
Clipboard Viewer
I modified this VB6 example Clipboard Viewer/Monitor OCX to efficiently monitor the ClipBoard.
StartViewer True
Resources: