I've never used SendKey instructions before. I know they're considered a last resort but it's either SendKey or Macro Express and I haven't been particularly happy with Macro Express.
My goal here is to click on a window , select all, copy and paste the data into a spreadsheet. I'm currently selecting a worksheet in excel but ultimately I'm going to be copying data from a separate application.
I can see that I'm getting the CLICK and the CNTL + A to select all but the COPY and PASTE instructions don't appear to be going through.
Any advice?
My goal here is to click on a window , select all, copy and paste the data into a spreadsheet. I'm currently selecting a worksheet in excel but ultimately I'm going to be copying data from a separate application.
I can see that I'm getting the CLICK and the CNTL + A to select all but the COPY and PASTE instructions don't appear to be going through.
Any advice?
VBA Code:
Sub ABC()
Sheets("Results").Select
SetCursorPos 300, 400 'x and y position
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.SendKeys "^a", True
Application.Wait (Now + TimeValue("0:00:03"))
Application.SendKeys "^c", True
Application.Wait (Now + TimeValue("0:00:03"))
Sheets("Test").Select
Sheets("Test").Range("A1").Select
Application.SendKeys "^v", True
End Sub