How to Ping an IP Address using DoNetFactory

‘Creating the .Net Computer object

Set obj = DotNetFactory(“Microsoft.VisualBasic.Devices.Computer”,”Microsoft.VisualBasic”)

blnPingSuccess= ob.Ping(“127.0.0.1”)

Msgbox fnCheckResponse(“blnPingSuccess”,”Ping was Successful”,”Ping ws Unsuccessful”)

‘Wait for 5 Secs

blnPingSuccess = obj.Ping(“127.0.0.1”,5000)

Set obj = Nothing

 

Public Function fnCheckResponse(condition, string1, string2)

If Condition Then

fnCheckResponse =string1

Else

fnCheckResponse =string2

End If

End Function

Leave a comment