0

The page is coded in html5 and my code cannot scrape with this method:

Sub Macro1()
 With ActiveSheet.QueryTables.Add(Connection:= _
 “URL;https://exchange.btcc.com/”, Destination:=Range(“$A$1″))
 .Name = “market_trend”
 .FieldNames = True
 .RowNumbers = False
 .FillAdjacentFormulas = False
 .PreserveFormatting = True
 .RefreshOnFileOpen = False
 .BackgroundQuery = True
 .RefreshStyle = xlInsertDeleteCells
 .SavePassword = False
 .SaveData = True
 .AdjustColumnWidth = True
 .RefreshPeriod = 0
 .WebSelectionType = xlSpecifiedTables
 .WebFormatting = xlWebFormattingNone
 .WebTables = “4″
 .WebPreFormattedTextToColumns = True
 .WebConsecutiveDelimitersAsOne = True
 .WebSingleBlockTextImport = False
 .WebDisableDateRecognition = False
 .WebDisableRedirections = False
 .Refresh BackgroundQuery:=False
 End With`
 End Sub

Any idea how to scrape Price Ticker table from this site ?

digital.aaron
  • 5,435
  • 2
  • 24
  • 43

1 Answers1

1

Why not use the same method as in your last question:

Sub Tester()

    Dim IE As Object
    Dim tbl, trs, tr, tds, td, r, c

    Set IE = CreateObject("internetexplorer.application")

    IE.Navigate "https://exchange.btcc.com/"

    Do While IE.Busy = True Or IE.readyState <> 4: DoEvents: Loop

    Set tbl = IE.Document.getElementsByTagName("table")(5)
    Set trs = tbl.getElementsByTagName("tr")

    For r = 0 To trs.Length - 1
        Set tds = trs(r).getElementsByTagName("td")
        If tds.Length = 0 Then Set tds = trs(r).getElementsByTagName("th")

        For c = 0 To tds.Length - 1
            ActiveSheet.Range("A1").Offset(r, c).Value = tds(c).innerText
        Next c
    Next r

End Sub

This will give you result as follows:

enter image description here

Mrig
  • 11,612
  • 2
  • 13
  • 27