Here are my routines for IP conversion,
Note that I'm using Byte arrays and not Strings:
Code:
Private Function IPtoByte(ByVal sTemp As String) As Byte()
On Error GoTo HandleError
Dim lPos As Long
Dim sBucket() As String
Dim bTemp() As Byte
ReDim bTemp(0 To 3)
sBucket = Split(sTemp, ".")
For lPos = 0 To 3
bTemp(lPos) = CByte(Val(sBucket(lPos)))
Next lPos
IPtoByte = bTemp
Exit Function
HandleError:
Call LogError("IPtoByte")
End Function
Private Function ByteToIP(ByRef bTemp() As Byte, ByVal lTemp As Long) As String
On Error GoTo HandleError
ByteToIP = CStr(bTemp(lTemp)) _
& "." & CStr(bTemp(lTemp + 1)) _
& "." & CStr(bTemp(lTemp + 2)) _
& "." & CStr(bTemp(lTemp + 3))
Exit Function
HandleError:
Call LogError("ByteToIP")
End Function