#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Ping

Hi Guys,

This function returns the ping resolve time.

Function xlPing(strHost As String)
'Ping a host to see if it is alive
Dim objPing
Dim objRetStatus
Dim strMessage

If strHost = "" Then
xlPing = False
'MsgBox "No host defined", vbCritical, "Whoops"
Else
Set objPing = GetObject("winmgmts:
{impersonationLevel=impersonate}").ExecQuery("sele ct * from
Win32_PingStatus where address = '" & strHost & "'")
For Each objRetStatus In objPing
If IsNull(objRetStatus.StatusCode) Or objRetStatus.StatusCode <
0 Then
xlPing = False
Else
xlPing = objRetStatus.ResponseTime
End If
Next
End If

Set objPing = Nothing
Set objRetStatus = Nothing
End Function
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ping via VBA Garry Douglas[_2_] Excel Programming 9 January 3rd 08 04:56 PM
Ping a Set of IPs [email protected] Excel Programming 1 August 30th 06 06:01 PM
PING Bob Phillips Steve Excel Discussion (Misc queries) 3 July 4th 05 07:31 PM
ping in excel Andy Mohan Excel Programming 5 February 21st 05 10:08 PM
Ping anybody Laphan[_2_] Excel Programming 4 November 28th 03 02:51 AM


All times are GMT +1. The time now is 10:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"