Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue]Public Sub vbPing(sTarget As String)
Dim cPingResults As Object 'collection of instances of Win32_PingStatus class
Dim oPingResult As Object 'single instance of Win32_PingStatus class
Dim strMsg As String
Set cPingResults = GetObject("winmgmts:{impersonationLevel=impersonate}//./root/cimv2").ExecQuery("SELECT * FROM Win32_PingStatus WHERE Address = '" + sTarget + "'")
For Each oPingResult In cPingResults
strMsg = ""
If oPingResult.StatusCode = 0 Then
If LCase(sTarget) = oPingResult.ProtocolAddress Then
strMsg = strMsg & sTarget & " is responding" & vbCrLf
Else
strMsg = strMsg & sTarget & " (" & oPingResult.ProtocolAddress & ") is responding" & vbCrLf
End If
strMsg = strMsg & "Bytes = " & oPingResult.BufferSize & vbCrLf
strMsg = strMsg & "Time (ms) = " & oPingResult.ResponseTime & vbCrLf
strMsg = strMsg & "TTL (s) = " & oPingResult.ResponseTimeToLive
Else
strMsg = strMsg & sTarget & " is not responding"
End If
Next
MsgBox strMsg, vbOKOnly, "Pinging " & sTarget
End Sub
[/blue]