Windows Server Launching Putty from Excel


New Member

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:

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.


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?