从网站提取结果
Results extraction from website
我试图从类似 table:
中提取结果
我应用了以下代码,但似乎不起作用。关于应该使用哪些 table 元素有什么想法吗?:
Sub Macro1()
Dim IE As New InternetExplorer
Dim CompetitionLink As String
CompetitionLink = ThisWorkbook.Worksheets("Settings").Range("B2")
IE.Navigate CompetitionLink
IE.Visible = True
Rank = IE.Document.getElementsByTagName("grid sc")(0).Rows(1).Cells(2).innerText
Debug.Print Rank
End Sub
试试那个代码
Sub Test()
Dim ie As New InternetExplorer
Dim competitionLink As String
Dim rank As String
competitionLink = ThisWorkbook.Worksheets("Settings").Range("B2")
With ie
.Visible = True
.navigate competitionLink
Do: DoEvents: Loop Until .readyState = 4
rank = .document.getElementsByClassName("grid sc")(0).Rows(1).Cells(2).innerText
Debug.Print rank
End With
End Sub
** 您还可以抓取所有 table 数据..看看这个 link
Scrape HTML Table
我试图从类似 table:
中提取结果我应用了以下代码,但似乎不起作用。关于应该使用哪些 table 元素有什么想法吗?:
Sub Macro1()
Dim IE As New InternetExplorer
Dim CompetitionLink As String
CompetitionLink = ThisWorkbook.Worksheets("Settings").Range("B2")
IE.Navigate CompetitionLink
IE.Visible = True
Rank = IE.Document.getElementsByTagName("grid sc")(0).Rows(1).Cells(2).innerText
Debug.Print Rank
End Sub
试试那个代码
Sub Test()
Dim ie As New InternetExplorer
Dim competitionLink As String
Dim rank As String
competitionLink = ThisWorkbook.Worksheets("Settings").Range("B2")
With ie
.Visible = True
.navigate competitionLink
Do: DoEvents: Loop Until .readyState = 4
rank = .document.getElementsByClassName("grid sc")(0).Rows(1).Cells(2).innerText
Debug.Print rank
End With
End Sub
** 您还可以抓取所有 table 数据..看看这个 link Scrape HTML Table