+ Reply to Thread
Results 1 to 2 of 2

For loop - different pages

  1. #1
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    22

    For loop - different pages

    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

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: For loop - different pages


    Duplicate thread and code without tags !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Renumbering series of pages after removing pages
    By teaker in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-09-2013, 06:02 PM
  2. Replies: 1
    Last Post: 12-05-2012, 05:30 AM
  3. Replies: 2
    Last Post: 02-24-2009, 03:52 PM
  4. Replies: 1
    Last Post: 06-14-2006, 06:50 AM
  5. Replies: 2
    Last Post: 12-30-2005, 12:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1