patriciaxxx
Programmer
I need help with the following two problems.
I have the Access module below which goes to the webpage to check if the holders number has won anything and the results are displayed in the webpage. (Please note the holders number is an example).
My first problem is how can I retrieve those results and debug.Print them? I have tried to identify them in the html but can’t find them?
My second problem is how can I use MSXML2.xmlHttp to do the same job i.e. go to the page enter the form details and retrieve the same data.
I have the Access module below which goes to the webpage to check if the holders number has won anything and the results are displayed in the webpage. (Please note the holders number is an example).
My first problem is how can I retrieve those results and debug.Print them? I have tried to identify them in the html but can’t find them?
Code:
[COLOR=#204A87]Public Sub HaveIWon()
Dim objIE As Object
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.Navigate "[URL unfurl="true"]http://www.nsandi.com/savings-premium-bonds-have-i-won"[/URL]
Do While .readyState <> 4: DoEvents: Loop
With .Document.Forms(1)
.all("pbhn").Value = "123AB123456" 'Example holders number
.all("chkdrw").selectedIndex = 0
End With
.Document.Forms(1).submit
Debug.Print .Document.body.outerText
End With
Set objIE = Nothing
End Sub
[/color]
My second problem is how can I use MSXML2.xmlHttp to do the same job i.e. go to the page enter the form details and retrieve the same data.
Code:
[COLOR=#204A87]With CreateObject("MSXML2.xmlHttp")
.Open "GET", "[URL unfurl="true"]http://www.nsandi.com/savings-premium-bonds-have-i-won",[/URL] False
.send
Do Until .readyState = 4: DoEvents: Loop
If .Status = 200 Then
Set oHtml = New HTMLDocument
oHtml.body.innerHTML = .responseText
End If
End With
[/color]