Private Declare Function GetIpAddrTable_API Lib "IpHlpApi" Alias "GetIpAddrTable" _ (pIPAddrTable As Any, pdwSize As Long, ByVal bOrder As Long) As Long ' Returns an array with the local IP addresses (as strings). ' Author: Christian d'Heureuse, www.source-code.biz Public Function GetIpAddrTable() Dim bytBuffer(0 To 511) As Byte Dim nSize As Long Dim lngReturn As Long Dim intEntries As Integer Dim intEntry As Integer Dim intOctetNo As Integer Dim strOctet As String nSize = UBound(bytBuffer) + 1 lngReturn = GetIpAddrTable_API(bytBuffer(0), nSize, 1) If lngReturn <> 0 Then Err.Raise vbObjectError, , "GetIpAddrTable failed with return value " & lngReturn Else intEntries = bytBuffer(1) * 256 + bytBuffer(0) If intEntries = 0 Then GetIpAddrTable = Array() Else ReDim IpAddrs(0 To intEntries - 1) As String For intEntry = 0 To intEntries - 1 strOctet = "" For intOctetNo = 0 To 3 strOctet = strOctet & IIf(intOctetNo > 0, ".", "") & bytBuffer(4 + intEntry * 24 + intOctetNo) Next intOctetNo IpAddrs(intEntry) = strOctet Next GetIpAddrTable = IpAddrs End If End If End Function ' Test program for GetIpAddrTable. Public Sub Test() Dim strIPAddress As Variant Dim intAdressCount As Integer strIPAddress = GetIpAddrTable Debug.Print "Number of IP addresses: " & UBound(strIPAddress) - LBound(strIPAddress) + 1 For intAdressCount = LBound(strIPAddress) To UBound(strIPAddress) Debug.Print strIPAddress(intAdressCount) Next intAdressCount End Sub