Hi All,
I have the following code to open a webpage:
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 "e" in the code above. Following is the XML.
<SEARCH>
<TOTAL_ITEMS><SEARCH>
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?
I have the following code to open a webpage:
Code:
Sub Test()
Dim IE As Object
Dim x As Integer
Dim e As Variant
Dim d As Integer
Dim Ar1 As Variant
Ar1 = Array("food", "drinks")
For d = 0 To 1
x = 1
Do Until x = e + 1
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate "[URL]http://api.eventful.com/rest/events/search?...&c[/URL]=" & Ar1(d) & "&t=future&location=Chicago&page_number=" & x & "&page_size=100&app_key=xxxxx" ' 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
x = x + 1
IE.Quit
Loop
ActiveWorkbook.SaveAs Filename:="C:\Users\Schwimms\Desktop\Scraper\excel XML\" & Ar1(d) & ".xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.ClearContents
Selection.End(xlUp).Select
Range("A1").Select
Ar1(d) = Ar1(d + 1)
Next d
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 "e" in the code above. Following is the XML.
<SEARCH>
<TOTAL_ITEMS><SEARCH>
HTML:
360
100
4
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?