Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sendkey usage

Status
Not open for further replies.

sendkey

Programmer
Apr 10, 2001
1
CN
Can anyone tell me sendkey usage?
 
WshShell.Sendkeys keys

or

WshShell.SendKeys("10")

to type 10

easy eh?

remember

Shift is {+}
Ctrl is {^}
Alt is {%}
 
I am after the same thing as "Sendkey"... see question submitted today!
I tried your solution in the following way but it didn't work:
sub eften()
if gms.lbuttonup then
WshShell.Sendkeys("{F10}")
else
exit sub
end if
end sub

The error given was a runtime:
"object required: 'WshShell' (errcode=0x01A8)

I am sure that this all points to my poor understanding of some VBScript basics, but any help would be appreciated.
 
Neil,

I'm not totally sure this is the correct object, but what you're missing is the instantiation of the object that does the sendkeys.

Code:
sub eften()
   dim objShell

   set objShell = CreateObject("wscript.shell")
   if gms.lbuttonup then
      objShell.Sendkeys("{F10}")
   else
      exit sub
   end if
end sub



 
Glen,
thanks, I think I'm getting closer...
The response is still a run-time error, but it is now:

Type mismatch 'SendKeys' (errcode = 0x000D)

..Any suggestions

..Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top