I'm hoping this is quick and easy. This scripts seems to work OK as a VBS script but not in VBA. I just want to open a shull, run an executable which logs into a remote system, and then send "exit" to the shell so it quits. Works ok in VBS, but in VBA, I get an "Object Required" error on the sleep line.
Thanks in advance...
Thanks in advance...
Code:
Private Sub Command0_Click()
Dim WSHShell As Object
Set WSHShell = CreateObject("Wscript.Shell")
WSHShell.Run ("c:\plink -1 -i c:\privkey.ppk -l bob@host.com host.com")
Wscript.sleep 5000
WSHShell.SendKeys "exit"
WSHShell.SendKeys "{Enter}"
End Sub