Hi
can the code below be modified to use a FOR LOOP that will copy each page data one below the other
for example if I wanted pages 3 to 8 etc
Sub DemoXML()
Const HST$ = "registers.cidb.org.za", SRC$ = "https://" & HST, _
URL$ = "/PublicContractors/ContractorSearch?PageSize=40&PageNo=1&Region=4be86b26-80c6-e111-a22d-00155d022301&Columns=1100001001000"
Dim Hlnk As Hyperlink
Application.StatusBar = " Web download …"
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", SRC & URL, False
.setRequestHeader "DNT", "1"
.setRequestHeader "Host", HST
On Error Resume Next
.send
On Error GoTo 0
If .Status = 200 Then T$ = .ResponseText
End With
If T = "" Then
Beep
Else
With CreateObject("HTMLfile")
.Write T
If .parentWindow.clipboardData.setData("Text", _
.getElementsByTagName("TABLE")(1).outerHTML) Then
Application.ScreenUpdating = False: Me.Paste [B1]
.parentWindow.clipboardData.clearData "Text"
[A2].Select: ActiveWindow.FreezePanes = True
With [B1].CurrentRegion
For Each Hlnk In .Columns(1).Hyperlinks
With Hlnk
.Address = SRC & .Address: .ScreenTip = "View Contractor webpage"
End With
Next
.WrapText = False: .Columns("A:B").AutoFit
End With
End If
.Close
End With
End If
Application.StatusBar = False: End
End Sub
Bookmarks