+ Reply to Thread
Results 1 to 16 of 16

How Do I Open a Telnet Session From Excel?

Hybrid View

  1. #1
    Registered User
    Join Date
    08-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    How Do I Open a Telnet Session From Excel?

    Hello All,

    I am trying to figure out a way to open a telnet session from within Excel. I would like to be able to click on a particular cell, and have it perform a telnet command (telnet 192.168.***.***) that opens up to the banner page of a switch.

    If I could accomplish only that, I would be happy. But if possible, I would also like to have a script automatically input CTRL-Y in order to proceed past the banner page, and open the username and password prompt.

    Any help would be greatly appreciated.

    Thanks
    Last edited by Paul; 08-06-2014 at 04:29 PM. Reason: Problem Solved

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: How Do I Open a Telnet Session From Excel?

    Assuming your IP address/server is in cell A1, you can add this to your Worksheet's code. It doesn't add the CTRL+Y, as SendKeys is often unreliable and other methods get more complex.
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Target, Range("A1")) Is Nothing Then
        Cancel = True
        t = Shell("c:\windows\system32\telnet.exe " & Target.Value, vbNormalFocus)
    End If
    End Sub
    As noted in this thread http://www.excelforum.com/excel-gene...xcel-cell.html, you may need to install telnet in Windows 7/8 as it may not be installed by default.

  3. #3
    Registered User
    Join Date
    08-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: How Do I Open a Telnet Session From Excel?

    Thank you for the response Paul. Unfortunately, this script did not work for me . I entered the code into the sheet, and input the IP address of the switch into cell A1. Am I missing something? I get the following error every time I double-click the cell: Run-time error '53': File not found. And when I click on debug, it shows this portion of the script: "t = Shell("c:\windows\system32\telnet.exe " & Target.Value, vbNormalFocus)" highlighted in yellow.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: How Do I Open a Telnet Session From Excel?

    Did you see the linked post about installing Telnet? It is not installed by default in Windows 7 (and possibly 8). If it is installed, find the correct path to telnet.exe and adjust the path in the code to point there.

  5. #5
    Registered User
    Join Date
    08-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: How Do I Open a Telnet Session From Excel?

    I'm using Windows 8, and the path is the same as the one that you provided in the script (c:\windows\system32\telnet.exe).

    And telnet is enabled as I'm able to open telnet sessions using a command prompt.

  6. #6
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: How Do I Open a Telnet Session From Excel?

    Well, I can't get it to NOT work on my Win7 PC. No errors whether it's a server name (fully qualified or not) or an IP address.

    Only thing I can think of is that you may have forgotten to add a space after telnet.exe in the path. If that space is missing, you'll be sending a command like

    c:\windows\system32\telnet.exeSERVERNAME

    instead of

    c:\windows\system32\telnet.exe SERVERNAME

    Unfortunately I don't have a Win8 PC handy to test on my own.

    Edit: Just tested by removing the space after the telnet.exe and I get your File not found error 53.

  7. #7
    Registered User
    Join Date
    08-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: How Do I Open a Telnet Session From Excel?

    Thanks for your continued help Paul.

    I checked the syntax, but unfortunately I still receive the same error.

    Here are the steps that I take:
    1) Open an excel spreadsheet
    2) right click on the sheet tab, and select "view code."
    3) paste in the script exactly as seen here:
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        If Not Intersect(Target, Range("A1")) Is Nothing Then
              Cancel = True
        t = Shell("c:\windows\system32\telnet.exe " & Target.Value, vbNormalFocus)
        End If
        End Sub
    5) Close the Visual Basic window and return to the spreadsheet
    6) Enter the IP Address I'm trying to telnet to, into cell A1
    7) Double-click cell A1

    Am I missing a step somewhere? Or do I need to add the IP address into the script? Or is there anything else you can think of?
    Last edited by Paul; 08-06-2014 at 02:07 PM. Reason: Added CODE tags.

  8. #8
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: How Do I Open a Telnet Session From Excel?

    Nothing rings a bell, and without a Win8 PC to test here I can't do much more unfortunately. I know this is not exactly related, but are you using 64-bit Win8? Perhaps when launching telnet via command it launches the 64-bit telnet EXE, but the version in c:\windows\system32\ is the 32-bit version and causing a problem?

    http://superuser.com/questions/46339...command-prompt

    Hopefully this helps..

  9. #9
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: How Do I Open a Telnet Session From Excel?

    Nothing rings a bell, and without a Win8 PC to test here I can't do much more unfortunately. I know this is not exactly related, but are you using 64-bit Win8? Perhaps when launching telnet via command it launches the 64-bit telnet EXE, but the version in c:\windows\system32\ is the 32-bit version and causing a problem?

    http://superuser.com/questions/46339...command-prompt

    Hopefully this helps..

  10. #10
    Registered User
    Join Date
    08-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: How Do I Open a Telnet Session From Excel?

    Actually I am using 64 bit. Would I need to modify the script in some way to accommodate that?

  11. #11
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: How Do I Open a Telnet Session From Excel?

    You probably need to find the path to the 64-bit telnet.exe, as stated in the linked article. Beyond that I can't be much more help since I don't have Win8 or 64-bit machines handy.

  12. #12
    Registered User
    Join Date
    08-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: How Do I Open a Telnet Session From Excel?

    I will look into that. Thanks for all your help

  13. #13
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: How Do I Open a Telnet Session From Excel?

    I think I figured out an option...

    Copy telnet.exe from c:\windows\system32 to c:\windows\syswow64. After doing so I was able to execute the code on my 64-bit PC (Win7) running Office 32-bit. Hopefully that works for you too.

  14. #14
    Registered User
    Join Date
    08-28-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Lightbulb Re: How Do I Open a Telnet Session From Excel?

    Paul you are the man! lol After copying telnet.exe into my syswow64 folder it worked like a charm! Thanks a lot this saved the day.

  15. #15
    Registered User
    Join Date
    05-02-2017
    Location
    Cochin
    MS-Off Ver
    2013
    Posts
    35

    Re: How Do I Open a Telnet Session From Excel?

    Hello danaconda84,
    I was trying to use the code to telnet device in windows7 OS system it works perfectly..Thanks however it's not working when am trying the same with Windows 10 supported system.Please help here.

    Note:I have changed the path where the telnet.exe is placed in Windows10 system.

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How Do I Open a Telnet Session From Excel?

    pramoth.u welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Embed a Telnet Session in Excel
    By danaconda84 in forum Excel General
    Replies: 1
    Last Post: 07-30-2014, 04:48 PM
  2. Need Help Hyperlinking to a Batch File
    By danaconda84 in forum Excel General
    Replies: 0
    Last Post: 09-04-2013, 01:32 PM
  3. Open Excel Template in New Session
    By Sofistikat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2011, 10:56 PM
  4. How can I hyperlink to a telnet session?
    By mike in forum Excel General
    Replies: 0
    Last Post: 04-26-2006, 05:00 PM
  5. Each New Excel to open in another session
    By tinwasp in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-08-2005, 01:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1