Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

objShell.Run Help

Status
Not open for further replies.

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top