I call this from an event handler.
al
'
'
'
Public Sub SSHToTarget(ByRef visWin As Visio.Window, _
ByVal strShape As String)
On Error GoTo ErrHandler
Dim visPage As Visio.Page
Dim visShapes As Visio.Shapes
Dim visShape As Visio.Shape
Dim visCell As Visio.Cell
Dim shellWin As Object
Dim strCommand As String
strCommand = "C:\Program Files (x86)\VanDyke
Software\SecureCrt\securecrt "
Set visPage = visWin.Page
Set visShapes = visPage.Shapes
Set visShape = visShapes.Item(strShape)
' can we determine the rules appropriate
' if there get ip address if not get out
If visShape.CellExists("prop.compIpAddress", False)
Then
Set visCell =
visShape.Cells("prop.compIpAddress")
strCommand = strCommand & visCell.ResultStr("")
Else
MsgBox ("couldn't find compIpAddress custom
property")
Exit Sub
End If
' create the script shell environment
Set shellWin = CreateObject("wscript.shell")
' now execute the command that we built
'Debug.Print "shellwin start"
DoEvents
shellWin.Run strCommand
DoEvents
Exit Sub
ShellCommand:
'Debug.Print "shell start"
Shell strCommand, vbNormalFocus
'Debug.Print "shell start"
DoEvents
Exit Sub
ErrHandler:
Dim myErr As ErrObject
Set myErr = Err
If Err.Number = -2147024894 Then
Debug.Print "shellwin failed"
GoTo ShellCommand
End If
Debug.Print "ssh " & Err.Description
End Sub