Hi,
using Excel VBA I am entering information onto a web page, submitting the data but cannot read the results page, the Internet Explorer's document is still holding the original page's html.
I have tried putting 5 second waits, 10 second waits even 1 minute waits after the ready state is OK after the form submit but to no avail.
The results URL contains no info so I cannot navigate there, and I cannot use a POST with the data variables from the input form because a unique reference is required each time ( as part of the POST data).
All required project references have been made
Could somebody point me in the right direction please?
using Excel VBA I am entering information onto a web page, submitting the data but cannot read the results page, the Internet Explorer's document is still holding the original page's html.
I have tried putting 5 second waits, 10 second waits even 1 minute waits after the ready state is OK after the form submit but to no avail.
The results URL contains no info so I cannot navigate there, and I cannot use a POST with the data variables from the input form because a unique reference is required each time ( as part of the POST data).
All required project references have been made
Could somebody point me in the right direction please?
Code:
Sub ParseInternet()
Dim i As Integer
Dim post_code As String
Dim house_num As String
post_code = CStr(Sheet1.Cells(9, 2).Value)
house_num = CStr(Sheet1.Cells(9, 1).Value)
If post_code = "" Then
MsgBox ("House Name /Number and postcode MUST be entered")
Exit Sub
End If
Set Site = CreateObject("InternetExplorer.application")
Dim URL As String
URL = "[URL unfurl="true"]http://landregistry.data.gov.uk/app/ppd"[/URL]
Site.Navigate URL
While Site.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Application.Wait (Now + TimeValue("0:00:10"))
Site.Visible = True
Site.Document.getElementById("paon").Value = house_num
Site.Document.getElementById("postcode").Value = post_code
Site.Document.forms(0).submit
While Site.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Application.Wait (Now + TimeValue("0:00:10"))
'''''PREVIOUS PAGE'S HTML STILL IN SITE.DOCUMENT
Set HTMLTD = Site.Document.getElementsByTagName("TD")
For xTD = 0 To HTMLTD.Length - 1
j = Len(Site.Document.getElementsByTagName("TD")(xTD).innerText)
If j > 0 And j < 20 Then
Sheet1.Cells(9, xTD + 1).Value = Site.Document.getElementsByTagName("TD")(xTD).innerText
Exit Sub
End If
Next xTD
End Sub