Consulting

Results 1 to 12 of 12

Thread: Telnet From VBA

  1. #1

    Telnet From VBA

    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?

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    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/Script...owerShell.aspx

  3. #3
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    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?
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  4. #4
    RExec looks like the best bet - However thsi prompts you for a password which cannot be inputted on the command line

  5. #5
    Quote Originally Posted by Kenneth Hobs
    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/Script...owerShell.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?

  6. #6
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    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.

  7. #7
    Quote Originally Posted by Kenneth Hobs
    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...

  8. #8
    Quote Originally Posted by CreganTur
    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?

  9. #9
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    Are you using Attachmate for your terminal or something similar?
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  10. #10
    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..

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

  11. #11
    VBAX Master CreganTur's Avatar
    Joined
    Jan 2008
    Location
    Greensboro, NC
    Posts
    1,676
    Location
    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.
    -Randy Shea
    I'm a programmer, but I'm also pro-grammar!
    If your issue is resolved, please use Thread Tools to mark your thread as Solved!

    PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003


  12. #12
    thanks for the tip i'll go try..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •