Windows Server Launching Putty from Excel


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.




Windows Forum Team
Staff member
Premium Supporter
Putty readme = PuTTY: a free SSH and Telnet client

p.s, Take the warning about Putty being illegal in many countries seriously!


Windows Forum Team
Staff member
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?

This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.