1
我使用VBA Excel從互聯網上抓取一些數據。 的鏈接是:VBA Excel從網站表中獲取第一行數據
http://www.baseball-reference.com/boxes/BOS/BOS199004090.shtml
我想提取這些線,以在不同的小區中的每個元素:
傑克莫里斯,L(0-1)6.2 7 5 2 3 3 0 2.7 31 95 52 31 7 14 8 17 5 0 46 0.62 -0.252 -2.1
我的代碼:
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.Visible = True
objIE.Navigate ("http://www.baseball-reference.com/boxes/BOS/BOS199004090.shtml")
Do
DoEvents
If Err.Number <> 0 Then
objIE.Quit
Set objIE = Nothing
GoTo j:
End If
Loop Until objIE.ReadyState = 4
item = objIE.Document.getElementsByClassName("suppress_csv sortable stats_table now_sortable")(0).getElementsByTagName("td")(0)
我嘗試不同的組合來提取我的項目但似乎沒有任何工作。先謝謝你。
可以更容易與Power查詢很多,如果您的Excel版本支持 – Slai
你的項目是,如果你好多了集中在聖路易斯紅雀隊:P – PeterT
STL也在我的名單上:P ...一旦我能弄清楚這個爛攤子..其他任何東西都會變得更容易:) –