Copy paste with Excel?

Discussion, questions and support.
Post Reply
jeremy505
Posts: 2
Joined: May 2nd, ’23, 18:10

Post by jeremy505 » May 2nd, ’23, 18:17

Hello,

I am trying to automate data entry from an excel file into a web based form. The keyboard shortcuts I am trying to emulate are:
1. Select cell in Excel
2. Copy text
3. Alt tab to Google Chrome
4. Paste text
5. Tab to next cell in Google Chrome
6. Alt tab back to Excel
7. Move down 1 cell
8. Repeat

The start of the shortcut in FastKeys is pasted below. Every time I try to run it my computer makes an audible Ding but nothing happens. I read somewhere on this board that there may be an issue copying directly from Excel. Is there a workaround for this?

{Control Down}C{Control Up}
{Alt Down}{Tab}{Alt Up}
{Control Down}V{Control Up}
{Tab}
{Alt Down}{Tab}{Alt Up}
{Down}

Thank you
User avatar
Marko
Posts: 1756
Joined: Mar 2nd, ’13, 21:02

Post by Marko » May 3rd, ’23, 20:23

Set a new shortcut, Type: Command. The following example will loop 5 times.
To run it, select the first cell in Chrome then the first cell in Excel and press a shortcut. Both windows must be opened.

Code: Select all

loop 5
{
	send, ^c
	WinActivate, ahk_class Chrome_WidgetWin_1
	send, ^v
	send, {Tab}

	WinActivate, ahk_class XLMAIN
	send, {Down}
}
return
jeremy505
Posts: 2
Joined: May 2nd, ’23, 18:10

Post by jeremy505 » May 4th, ’23, 22:12

I have the code saved as a command and when I execute it it appears to alt tab back and forth between Chrome and Excel, and also uses the Paste function each time it switches back to Chrome, but it doesn't actually copy anything from Excel. Everything seems to work as intended except actually Copy from Excel.

PS: I had to remove "CODE: SELECT ALL" from the beginning as FastKeys was giving me an error.
User avatar
Marko
Posts: 1756
Joined: Mar 2nd, ’13, 21:02

Post by Marko » May 5th, ’23, 21:17

Make sure you select the first cell in Excel before pressing the shortcut. You may also need to add a short sleep after copying.

Code: Select all

loop 5
{
	send, ^c
        sleep, 100
	WinActivate, ahk_class Chrome_WidgetWin_1
        sleep, 100	
        send, ^v
	send, {Tab}
	WinActivate, ahk_class XLMAIN
        sleep, 100
	send, {Down}
}
return
Post Reply