Advertisement
tpsingh26

Untitled

Jul 8th, 2021
307
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Ping(strip)
  2. Dim objshell, boolcode
  3. Set objshell = CreateObject("Wscript.Shell")
  4. boolcode = objshell.Run("ping -n 1 -w 1000 " & strip, 0, True)
  5. If boolcode = 0 Then
  6.     Ping = True
  7. Else
  8.     Ping = False
  9. End If
  10. End Function
  11. Sub PingSystem()
  12. Dim strip As String
  13. Dim strPhoneNumber As String
  14. Dim strMessage As String
  15. Dim strPostData As String
  16. Dim IE As Object
  17.  
  18. strPhoneNumber = Sheets("DATA").Cells(2, 1).Value
  19.  
  20. For introw = 2 To ActiveSheet.Cells(65536, 2).End(xlUp).Row
  21.     strip = ActiveSheet.Cells(introw, 2).Value
  22.     If Ping(strip) = True Then
  23.         ActiveSheet.Cells(introw, 3).Interior.ColorIndex = 0
  24.         ActiveSheet.Cells(introw, 3).Font.Color = RGB(0, 0, 0)
  25.         ActiveSheet.Cells(introw, 3).Value = "Online"
  26.         Application.Wait (Now + TimeValue("0:00:01"))
  27.         ActiveSheet.Cells(introw, 3).Font.Color = RGB(0, 200, 0)
  28.        
  29. 'Send Whatsapp Message
  30.        strMessage = "Ping " & ActiveSheet.Cells(introw, 1).Value & " " & ActiveSheet.Cells(introw, 2).Value & " is Online"
  31.        
  32. 'IE.navigate "whatsapp://send?phone=phone_number&text=your_message"
  33.        strPostData = "whatsapp://send?phone=" & strPhoneNumber & "&text=" & strMessage
  34.         Set IE = CreateObject("InternetExplorer.Application")
  35.         IE.navigate strPostData
  36.         Application.Wait Now() + TimeSerial(0, 0, 3)
  37.         SendKeys "~"
  38.  
  39.         Set IE = Nothing
  40.        
  41.     Else
  42.         ActiveSheet.Cells(introw, 3).Interior.ColorIndex = 0
  43.         ActiveSheet.Cells(introw, 3).Font.Color = RGB(200, 0, 0)
  44.         ActiveSheet.Cells(introw, 3).Value = "Offline"
  45.         Application.Wait (Now + TimeValue("0:00:01"))
  46.         ActiveSheet.Cells(introw, 3).Interior.ColorIndex = 6
  47.        
  48. 'Send Whatsapp Message
  49.        strMessage = "Ping " & ActiveSheet.Cells(introw, 1).Value & " " & ActiveSheet.Cells(introw, 2).Value & " is Offline"
  50.        
  51. 'IE.navigate "whatsapp://send?phone=phone_number&text=your_message"
  52.        strPostData = "whatsapp://send?phone=" & strPhoneNumber & "&text=" & strMessage
  53.         Set IE = CreateObject("InternetExplorer.Application")
  54.         IE.navigate strPostData
  55.         Application.Wait Now() + TimeSerial(0, 0, 3)
  56.         SendKeys "~"
  57.         Set IE = Nothing
  58.     End If
  59. Next
  60. End Sub
  61.  
  62.  
  63.  
Advertisement
RAW Paste Data Copied
Advertisement