Excel/Visual Basic – Trigger PuTTY (or SecureCRT) directly from Excel

SSH directly from Microsoft Excel!

Right-click your sheet name and select “View Code”.
Paste this in:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

pathDesktop = Environ("USERPROFILE") & "\Desktop"

If Target.Column = 2 Then

  Shell pathDesktop & "\putty.exe -l cisco -pw cisco " & ActiveSheet.Cells(Target.Row, 2), vbNormalFocus

End If
End Sub

Change “Target.Column = 2” to whatever column you want to click on.
Change “(Target.Row, 2)” to the location of the IP or hostname to connect to.

Use this shell line for SecureCRT (I haven’t tested this though):

'Shell "C:\CyberTransport\01_Applications\LaunchPad\bin\SecureCRT803\SecureCRT.exe /T /SSH2 /ACCEPTHOSTKEYS " & ActiveSheet.Cells(Target.Row, 2), vbNormalFocus

Leave a Reply

Your email address will not be published. Required fields are marked *