Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi People,
This function returns the IP Address of a known host. I hope you find it useful. Function xlGetIPAddress(strHost As String) 'Ping a host to see if it is alive Dim objPing Dim objRetStatus Dim strMessage If strHost = "" Then xlGetIPAddress = False 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 xlGetIPAddress = False Else xlGetIPAddress = objRetStatus.ProtocolAddress End If Next End If Set objPing = Nothing Set objRetStatus = Nothing End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I create a cell reference from ADDRESS function return? | Excel Worksheet Functions | |||
Address function to return values from min row | Excel Discussion (Misc queries) | |||
How do I use a function to return the address of a cell? | Excel Worksheet Functions | |||
function to return cell address | Excel Programming | |||
Convert IP Address to Host Name | Excel Programming |