Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SendKeys syntax problem VBAvirgin New Users to Excel 2 January 4th 06 04:42 PM
Starting telnet/ssh from Excel Thomas Aure Excel Programming 1 May 31st 05 08:23 AM
Problem with SendKeys + active window Roadie Excel Programming 4 April 26th 04 04:07 PM
SendKeys problem Rod Armour Excel Programming 3 January 23rd 04 10:44 PM
SendKeys and Path Problem rdcord Excel Programming 3 September 11th 03 06:12 PM


All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"