页面以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
编码,我的代码无法使用此方法:
{{1}}
知道如何从这个网站上刮下Price Ticker表吗?
答案 0 :(得分:0)
为什么不使用与上一个问题相同的方法:
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
这将给你如下结果: