Sub TestPing()
Dim strComputer As String
strComputer = "<TargetComputerAddress>"
If Not SystemOnline(strComputer) Then
MsgBox "This computer is currently unreachable: " & strComputer, vbOKOnly, "Computer Status"
'....your logic
Else
'...your logic
MsgBox "This computer is Online!", vbOKOnly, "Computer Status"
End If
End Sub
'TestPing
'Determine if system is online
Function SystemOnline(ByVal ComputerName As String)
Dim oShell, oExec As Variant
Dim strText, strCmd As String
strText = ""
strCmd = "ping -n 3 -w 1000 " & ComputerName
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec(strCmd)
Do While Not oExec.StdOut.AtEndOfStream
strText = oExec.StdOut.ReadLine()
If InStr(strText, "Reply") > 0 Then
SystemOnline = True
Exit Do
End If
Loop
End Function
originally from here :
http://forums.devshed.com/visual-bas...ba-328706.html
Tested and working on my system and worked ok if it's any good to you?