As simple as this:
VB Code:
Dim telnet telnet = Shell("telnet.exe", vbNormalFocus) AppActivate telnet, True SendKeys "open", True
but why it doesn't work?
Printable View
As simple as this:
VB Code:
Dim telnet telnet = Shell("telnet.exe", vbNormalFocus) AppActivate telnet, True SendKeys "open", True
but why it doesn't work?
Doesn't work is very vague... What is the problem? It doesn't get activated? It doesn't send the keys?
You know, for kids!
The problem is that i can't even run that, it gives an error in
AppActivate telnet, True - invalid procedure call or argument
i'v tryed to using just shell("telnet.exe") and then sendkeys but the telnet window didn't received any key.
Hey I got it to work just fine.
VB Code:
Private Sub Command1_Click() AppActivate telnet SendKeys "Hi" & vbCrLf End Sub Private Sub Form_Load() telnet = Shell("telnet.exe", vbNormalFocus) End Sub
The vbCrLf in there is the enter key in case you didn't know.
invalid procedure call or argument
on AppActivate telnet
In my code, 'Telnet' needs to be in a higher scope. If you had tried to run it as i had posted it before, 'Telnet' would have a value of zero in the Command1_Click() routine. Maybe that's your problem, I don't know. But it works when I try it.
VB Code:
Option Explicit Dim Telnet As Double Private Sub Command1_Click() AppActivate Telnet SendKeys "Hi" & vbCrLf End Sub Private Sub Form_Load() Telnet = Shell("telnet.exe", vbNormalFocus) End Sub
well...this didn't worked for me, it's strange but it didn't work :(