Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Function to Return the IP Address of a known Host

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
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
how do I create a cell reference from ADDRESS function return? Coachdenny Excel Worksheet Functions 3 December 2nd 08 04:22 AM
Address function to return values from min row Laury Excel Discussion (Misc queries) 3 October 4th 07 07:59 PM
How do I use a function to return the address of a cell? ren6175 Excel Worksheet Functions 6 April 21st 05 03:13 PM
function to return cell address Papa Jonah Excel Programming 1 November 19th 04 09:35 PM
Convert IP Address to Host Name Ed Wurster Excel Programming 4 October 28th 04 01:14 PM


All times are GMT +1. The time now is 06:52 AM.

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"