Windows Server Launching Putty from Excel

Discussion in 'Programming and Scripting' started by erling, Jan 20, 2016.

Tags:
  1. erling

    erling New Member

    Joined:
    Jan 20, 2016
    Messages:
    1
    Likes Received:
    0
    Hi,

    I have a Excel spreadsheet with hostnames in column A.
    I have added this macro so that I can doubleclick to launch Putty to log on a given host with ssh:

    Code:
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Range("A" & ActiveCell.Row) <> Empty Then
    Shell "C:\Program Files (x86)\putty\putty.exe -agent @" & ActiveCell, vbNormalFocus
    End If
    End Sub

    It works, but I have not been able to user pageant to avoid typing my password (I want to use key based auth).
    Pageant works well if I start putty outside of Excel.
    I have also tried to start pageant with a macro from Excel with no sucess.

    Do you have any idea how I can fix this? I suspect it may be something with environment variables, etc if there is such a thing in Windows.

    Thanks,

    Erling
     
  2. ussnorway

    ussnorway Windows Forum Team
    Staff Member Premium Supporter

    Joined:
    May 22, 2012
    Messages:
    2,530
    Likes Received:
    314
  3. Neemobeer

    Neemobeer Windows Forum Team
    Staff Member

    Joined:
    Jul 4, 2015
    Messages:
    2,382
    Likes Received:
    360
    Yes Windows has environment variables they can be set with set <variable>=data and expanded with %variablename% You may want to try running the macro command from a command prompt and see if it generates an error. Also do you have all the keys imported into putty?
     

Share This Page

Loading...