Press CTRL and Home keys

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
nodochau
Pro Scripter
Posts: 131
Joined: Wed Jan 16, 2019 12:59 pm

Press CTRL and Home keys

Post by nodochau » Wed Mar 25, 2020 5:47 pm

Hello ,
How to write a script to press CTRL and Home keys to move from whatever cell to A1 cell in Excel?
I tried press and send, Press and press, holdkey... and non of them work
Please help.

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Press CTRL and Home keys

Post by Marcus Tettmar » Wed Mar 25, 2020 6:44 pm

Something like:

Code: Select all

SetFocus>Microsoft Excel*
Press CTRL
Press Home
Release CTRL
Adjust window title accordingly.

Better would be to use XLSelectRange
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Press CTRL and Home keys

Post by JRL » Wed Mar 25, 2020 6:45 pm

This works for me.

Code: Select all

SetFocus>Excel*

Press ctrl
Press Home
Release ctrl

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts