Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Ping(strip)
- Dim objshell, boolcode
- Set objshell = CreateObject("Wscript.Shell")
- boolcode = objshell.Run("ping -n 1 -w 1000 " & strip, 0, True)
- If boolcode = 0 Then
- Ping = True
- Else
- Ping = False
- End If
- End Function
- Sub PingSystem()
- Dim strip As String
- Do Until Sheet1.Range("F1").Value = "STOP"
- Sheet1.Range("F1").Value = "TESTING"
- For introw = 6 To ActiveSheet.Cells(65536, 3).End(xlUp).Row
- strip = ActiveSheet.Cells(introw, 3).Value
- If Ping(strip) = True Then
- ActiveSheet.Cells(introw, 4).Interior.ColorIndex = 0
- ActiveSheet.Cells(introw, 4).Font.Color = RGB(0, 0, 0)
- ActiveSheet.Cells(introw, 4).Value = "Online"
- Application.Wait (Now + TimeValue("0:00:01"))
- ActiveSheet.Cells(introw, 4).Font.Color = RGB(0, 200, 0)
- Else
- ActiveSheet.Cells(introw, 4).Interior.ColorIndex = 0
- ActiveSheet.Cells(introw, 4).Font.Color = RGB(200, 0, 0)
- ActiveSheet.Cells(introw, 4).Value = "Offline"
- Application.Wait (Now + TimeValue("0:00:01"))
- ActiveSheet.Cells(introw, 4).Interior.ColorIndex = 6
- End If
- If Sheet1.Range("F1").Value = "STOP" Then
- Exit For
- End If
- Next
- Loop
- Sheet1.Range("F1").Value = "IDLE"
- End Sub
- Sub stop_ping()
- Sheet1.Range("F1").Value = "STOP"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement