Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
sendkeys problem for telnet
hi
i wrote this piece of code Private Sub CommandButton1_Click() Dim ReturnValue ReturnValue = Shell("c:\windows\system32\telnet", 1) ' Run Calculator. For t = 1 To 10000000 Next t Application.SendKeys "open" Application.SendKeys ("{Enter}") End Sub When i click, the telnet program opens and all i get was Welcome to Microsoft Telnet Client Escape Character is 'CTRL+]' Microsoft Telnet but did not see "open" how should sendkeys be done in this case?? thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
sendkeys problem for telnet
Dont't use Application.SendKeys, since it then sends the keystrokes to the
Application (Excel). Instead, just use SendKeys - and to make sure you send them to Telnet, use AppActivate "Telnet" first; e.g: AppActivate "Telnet" (see note below) SendKeys "open{ENTER}" The AppActivate argument should match exactly the windows title (title bar text) of your telnet app, I just don't know what that is. One thing: in odd cases, another app may grab control of windows between your AppActivate and SendKeys statements, making the keys go to the wrong app. For example, I have had Groupwise notifications pop up at the wrong time and steal focus from the app I want to send keys to. So be careful! Another note: In your timing loop, it is good to put DoEvents to allow Windows to do some processing tasks while the loop runs, otherwise you might freeze things up for a while - and I prefer to use a timed loop instead of looping to some number, e.g. for a 10 second delay: QuitTime = Now()+ TimeValue("00:00:10") While QuitTime = Now() DoEvents Wend "mike" wrote: hi i wrote this piece of code Private Sub CommandButton1_Click() Dim ReturnValue ReturnValue = Shell("c:\windows\system32\telnet", 1) ' Run Calculator. For t = 1 To 10000000 Next t Application.SendKeys "open" Application.SendKeys ("{Enter}") End Sub When i click, the telnet program opens and all i get was Welcome to Microsoft Telnet Client Escape Character is 'CTRL+]' Microsoft Telnet but did not see "open" how should sendkeys be done in this case?? thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SendKeys syntax problem | New Users to Excel | |||
Starting telnet/ssh from Excel | Excel Programming | |||
Problem with SendKeys + active window | Excel Programming | |||
SendKeys problem | Excel Programming | |||
SendKeys and Path Problem | Excel Programming |