WBURKERT
Technical User
- May 28, 2010
- 73
I am trying to use the paping.exe in an EXCEL VBA but the command is not getting executed. Doing the same with Ping.exe works as expected. The code below is showing the ping command working and the paping.exe commented out. the paping command works when manually entered in the command window. i would really appreciate someone looking at the paping line and help with what is wrong.
Code:
Function GetPingInfo(strComputer)
Dim objShell, boolCode
Set objShell = CreateObject("WScript.Shell")
'START paping routine
'paping [URL unfurl="true"]www.google.com[/URL] -p 80 -c 4
strPortNum = "8004"
'Checking program is not crashing here, that's all
MsgBox "strPortNum: value is " & strPortNum & vbCrLf, vbInformation
strWKB = "paping " & strComputer & " -p " & strPortNum & " -c 1 -t 5000"
'Checking program is not crashing here, that's all
MsgBox "strWKB: value is " & strWKB & vbCrLf, vbInformation
'boolCode = objShell.Run(strWKB, 0, True)
'MsgBox "boolCode: value is " & boolCode & vbCrLf, vbInformation
'START ping routine
boolCode = objShell.Run("Ping -n 1 -w 6000 " & strComputer, 0, True)
MsgBox "boolCode: value is " & boolCode & vbCrLf, vbInformation
If boolCode = 0 Then
GetPingInfo = "Successful Reply"
Else
GetPingInfo = "Failure"
End If
End Function