Sendkey on a particular foreground application, while Excel Sendkey Macro running in the background

There is an application on which i want to sendkey Tab , U ,Tab and then H by only pressing Ctrl+H.
(Ctrl + H) = sendkey(Tab , U , Tab and H.)
Can i make any macro in excel which will be running in the background and can send desired key stroke on a particular application running in foreground , when i press any assiaghned button.

Ruth

Sendkey on foreground appl, ExcelSendKey macro runng in BkGround

There is an application on which i want to sendkey Tab , U ,Tab and then H by only pressing Ctrl+H.
(Ctrl + H) = sendkey(Tab , U , Tab and H.)
Can i make any macro in excel which will be running in the background and can send desired key stroke on a particular application running in foreground , when i press any assiaghned button.

Ruth

Please help Ruth, its urgent

Please help me, where are all the excelexperts, ???

Ruth

Vishesh's picture

You first need to get the

You first need to get the desired application activated. Then use the sendkeys.

However, sendkeys is not a foolproof solution. If you press any key or interfere while sendkeys is being executed it gives erroneous results.

Try something like this...
AppActivate "Microsoft Excel"
or
AppActivate "Microsoft Word"
or
AppActivate "Microsoft Internet Explorer"

If you the want to shut it down:
SendKeys "%{F4}", True

Thank You - Here are Full details

Thank you very much Vishesh for helping me ,Can i give you an example what i want to do?
Just assume i have already opened Internet explorer-Yahoomail.com Window on my desktop , on that already opend FOREGROUNDED Window i want to send following keystrokes just by pressing CTRL + H.
(1)Tab
(2)ABCD
(3)Tab
(4)1234 AND THEN AGAIN CTRL + H ...........UPTO 1000 times

CONDITIONS : I CAN NOT SWITCHOVER TO EXCEL MACRO BY ALT+TAB OR MOUSE(To activate that macro) AND I NEED TO PERFORM THIS CTRL + H TASK REPEATEDLY ON THE SAME WINDOW WITHOUT SWITCHOVER TO ANY OTHER WINDOW.

If not Sendkey then anything else you will suggest?The basic requirement is sending some FIXED keystrokes one after another by pressing CTRL+H on a particular application REPEATEDLY.Any thing in Windows itself available so that whenever i press CTRL + H, IT WILL SEND some keystrokes.

Thank you.
Regards
Ruth

Vishesh's picture

Put the following lines in a

Put the following lines in a macro procedure...

'----Activate Internet Explorer--------
AppActivate "Windows Internet Explorer"
SendKeys "{TAB}"
SendKeys "ABCD"
SendKeys "{TAB}"
SendKeys "1234"
'----Activate back Excel Application----
AppActivate "Microsoft Excel"