Extract Data From A Webpage
Hi All,
I have the following code to open a webpage:
Code:
Dim IE As Object
Dim x As Integer
Dim c As Variant
x = 1
Do Until x = c + 1
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate "http://api.eventful.com/rest/events/search?...&c=food&t=future&location=Chicago&page_number=" & x & "&page_size=100&app_key=xxxx" ' should work for any URL"
Do Until .ReadyState = 4: DoEvents: Loop
End With
IE.ExecWB 17, 0 '// SelectAll
IE.ExecWB 12, 2 '// Copy selection
ActiveSheet.PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
Range("A1").Select
Selection.End(xlDown).Offset(1).Select
x = x + 1
IE.Quit
Loop
End Sub
The page that opens is in xml and in that xml there is the "page_count" that I need to pick out so I can tell my macro when to stop looping. I have dimmed it as "c" in the code above. Following is the XML.
<search>
<total_items>360</total_items>
<page_size>100</page_size>
<page_count>4</page_count>
Somehow I need c = "4", which is the "page_count". Does anyone know how I can pick out the "4" from the xml on my page?
Re: Extract Data From A Webpage
have a look at this post answered by pradeep here
and just check out Kleinma's signatures
Re: Extract Data From A Webpage
Not exactly what I was looking for but I can use this for something else... Thank you!