如何使用VBA在网页上加载所有结果?

时间:2017-01-10 20:05:15

标签: vba excel-vba hyperlink click excel

我想从以下网站加载所有游戏。

http://www.flashscore.com/soccer/england/premier-league-2015-2016/results/

首次加载页面只显示总结果的一部分,但我想从页面加载所有数据。

即使我使用以下代码按下链接"显示更多匹配",仍有隐藏的游戏未显示。

有人可以帮我提一些提示吗?

Image link

我的代码如下:

Sub Test_Flashscore()

Dim URL As String
Dim ie As New InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim dictObj As Object: Set dictObj = CreateObject("Scripting.Dictionary")
Dim tRowID As String

URL = "http://www.flashscore.com/soccer/england/premier-league-2015-2016/results/"

With CreateObject("InternetExplorer.Application")
    .Visible = True
    .navigate URL
    Do: DoEvents: Loop While .Busy Or .readyState <> 4
    Do: DoEvents: Loop While .document.readyState <> "complete"
    .document.parentWindow.execScript "loadMoreGames();"
    Do: DoEvents: Loop While .document.getElementById("preload").Style.display = "none"
End With


Set ie = Nothing
MsgBox "Process Completed"

End Sub

1 个答案:

答案 0 :(得分:0)

很快,它必须是该网站还是值得考虑的其他饲料?

也许:http://www.football-data.co.uk/englandm.php 所以: http://www.football-data.co.uk/mmz4281/1617/E0.csv