PDA

View Full Version : Telnet From VBA



ChloeRadshaw
11-21-2008, 02:16 AM
I posted an article on this forum about using SSH through VBA

I ve been trying for a number of days to get telnet to work without any joy whatsoever.

Ultimately I need to be able to issue a command and read the return response - From what I gather telnet does not write to stdout so does anyone know whether this is even possible?

Kenneth Hobs
11-21-2008, 08:28 AM
You can use Shell to execute Telnet. Getting a response back is limited to what Shell returns.

Other considerations would be:
1. .Net using a 3rd party ActiveX control.
2. Hyperterminal
3. PowerShell http://www.leeholmes.com/blog/ScriptingNetworkTCPConnectionsInPowerShell.aspx

CreganTur
11-21-2008, 08:32 AM
Are you working with 3270 or another IBM mainframe?

I cannot directly automate (via OLE Automation) my company's main Terminal program. Instead we use Attachmate Extra X-Treme for any Terminal automation. It works great and can be fully automated via VBA- I can scrape data from the screens and push data to the terminal.

Maybe this could help?

ChloeRadshaw
11-21-2008, 09:42 AM
RExec looks like the best bet - However thsi prompts you for a password which cannot be inputted on the command line

ChloeRadshaw
11-21-2008, 01:58 PM
You can use Shell to execute Telnet. Getting a response back is limited to what Shell returns.

Other considerations would be:
1. .Net using a 3rd party ActiveX control.
2. Hyperterminal
3. PowerShell http://www.leeholmes.com/blog/ScriptingNetworkTCPConnectionsInPowerShell.aspx


Why .Net ? Cant you use an activeX control and include this reference in the VBA editor? Do you know of any libraries that would be useful for this?

My colleagues suggested WinSock API?

Kenneth Hobs
11-21-2008, 02:49 PM
The telnet activex controls that I saw when I searched were for .net. They would probably not work in vba but you can try. Most offer a free trial.

You may well find some Winsock activex controls if that is what you need. I know there are several API's that can use it. I thought you were set on using telnet though.

ChloeRadshaw
11-21-2008, 02:54 PM
The telnet activex controls that I saw when I searched were for .net. They would probably not work in vba but you can try. Most offer a free trial.

You may well find some Winsock activex controls if that is what you need. I know there are several API's that can use it. I thought you were set on using telnet though.


No I am happy to use winsock - The only thing that needs to be accomplished is to connect to a unix machine and run a command and be able to read the response.

I thought this would be very easy:(

Do you have a winsock API / DLL in mind that would acompplish this?

Just to be clear - I d like to be able to connect (using rexec/ssh / telnet/other) to a unix host and run a command...

sebas1102
04-14-2010, 03:22 AM
Are you working with 3270 or another IBM mainframe?

I cannot directly automate (via OLE Automation) my company's main Terminal program. Instead we use Attachmate Extra X-Treme for any Terminal automation. It works great and can be fully automated via VBA- I can scrape data from the screens and push data to the terminal.

Maybe this could help?

Hi there,
How do I "scrape" / push data to the terminal?
could i use something like myscreen.area(row1,column1,row2,column2) to copy the required area and paste into excel? Any objects or sessions i need to create?

CreganTur
04-14-2010, 07:03 AM
Are you using Attachmate for your terminal or something similar?

sebas1102
04-15-2010, 01:29 AM
I'm using eNetwork Personal Communications (IBM). Would I be able to use some sort of coding to scrape? I tried the below but got stuck at the 3rd line..

Dim Sys As Object, Sess As Object, Myscr As Object
Set Sys = CreateObject("PCOMM.autECLSession")
Set Sess = Sys.ActiveSession
Set Myscr = Sess.Screen

CreganTur
04-15-2010, 09:27 AM
See if you can find the object model online somewhere. For Attachmate I use the .putstring method to write back to the console and .SendKeys to send back command keystrokes.

sebas1102
04-17-2010, 01:04 AM
thanks for the tip i'll go try..