Hi I did have this code working some time ago and now for some reason it just returns a blank message box. In fact I have been trying to get this back running for many hours now and I am left with little option but to ask outside help. It is such a shame as this used to run nicely. I may have changed some of code by mistake. If any one would mind checking this code for me to see if at least that is correct I would be grateful. The Inet is set to default and I have tried different ports, my internet routes through a router, I have tried both with router firewall on and off and with port forwarding enabled for the relevent ports. Thanks in advance

Private Function RealIP()
On Error GoTo err

Dim before As String
Dim sitehtml As String
Dim myIP As String
Dim after As String

sitehtml = Inet.OpenURL("http://www.ip-adress.com/")
While Inet.StillExecuting
DoEvents
Wend

DivideText sitehtml, "My IP address: ", "</span></b></font></span>", before, myIP, after
RealIP = myIP

Exit Function
err:
RealIP = "ERROR: " & Error
End Function

As fast response, you have 2 things missing
Inet <-- is not declared
DivideText <-- which i guess it is a function is not there is your code.

You can stick with your code, and you can use my code if you find it better

Dim xmlHTTP
Dim URL As String
Set xmlHTTP = CreateObject("MSXML2.XMLHTTP")
URL = "http://www.perceler.com/getipadr1.php"
xmlHTTP.Open "GET", URL, False
xmlHTTP.Send
Debug.Print xmlHTTP.responseText
Comments
Nice of him to offer me some help. Thank you.

Thanks for your help and your kind offer. I would prefer the site I already have to work like it like it used to, I cant think what ive done to it, I must have changed somthing while experimenting and accidently saved it. However the answer is a little beyond me, in the meantime I will continue to try and work it out, many thanks.

This was the main part of the rest of the code in case your interested.

Private Sub DivideText(ByVal txt As String, _
ByVal target1 As String, ByVal target2 As String, _
ByRef before As String, ByRef between As String, _
ByRef after As String)
Dim pos As Long

' Get the text before target1.
pos = InStr(txt, target1)
If pos = 0 Then
' target1 is missing. Set before = "".
before = ""
Else
' Set before.
before = Left$(txt, pos - 1)
' Remove up to target1 from the string.
txt = Mid$(txt, pos + Len(target1))
End If

' Get the text before target2.
pos = InStr(txt, target2)
If pos = 0 Then
' target2 is missing. Set between = "".
between = ""
Else
' Set between.
between = Left$(txt, pos - 1)
' Remove up to target2 from the string.
txt = Mid$(txt, pos + Len(target2))
End If

after = txt
End Sub

The site is changed, and the text below which you are searching for "</span></b></font></span>" is no more available.

Good luck.

Thanks that will help me work it out, while waiting I would advise against holding your breath.
Appreciate your time friend, all the best Bill

Hey thanks very much. I have worked out what is wrong now and managed to get it working from your url. I will try and improve my understanding of the code to enable me to get it working on any ip displaying site. This is the new code with your url as xxxx, I know there is parts there which need not be, so now ive a working version I will sort that out in due time which will also help me learn. Thanks again. Bill

Private Sub Form_Load()
'MsgBox RealIP
Text1.Text = Inet.OpenURL("http://www.perceler.com/getipadr1.php")
If Text1.Text = "" Then MsgBox ("Sorry IP Could Not Be Returned")
End Sub

Private Function RealIP()
On Error GoTo err

Dim before As String
Dim sitehtml As String
Dim myIP As String
Dim after As String

sitehtml = Inet.OpenURL("http://www.perceler.com/getipadr1.php")
While Inet.StillExecuting
DoEvents
Wend


RealIP = Inet.OpenURL

Exit Function
This question has already been answered. Start a new discussion instead.