Click here to Skip to main content
15,032,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sendkeys to windows application doesnt work. i have the following code
VB
Set objAP = CreateObject("wscript.shell")
  objAP.Run "aruser.exe" ' aruser is an windows application
  objAP.AppActivate "aruser.exe"
  objAP.SendKeys "gananu", True
  objAP.SendKeys "{TAB}", True
  objAP.SendKeys "gananu", True


When i run this code, it is printing 'gananu' in VB script editor itself, but my requirement is to send 'gananu' to aruser application.
Can someone help. Thanks, ganga
Posted
Updated 17-Feb-10 3:40am
v2

This example [^] works on my system.
Did you try to run the .vbs file outside the editor?



Please don't add 'fake answers': modify your original post (or write a new one).
Did you try the example of the link (i.e. maybe the problem is not the script, but the application you run)?
:)
   
v2
thanks for the reply. i tried creating a "command button" in excel sheet with this code and then run, still it failed.
   
Try to use WScript.Sleep afther the AppActivate call to pause the script for a couple of seconds and give the application time to be activated.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900