使用VBA控制Internet Explorer实例的弹出窗口

时间:2017-02-11 13:09:50

标签: vba excel-vba excel

单击父窗口上的按钮后,我想控制弹出窗口。在弹出窗口中,我希望能够单击匹配摘要按钮。我环顾互联网并没有找到任何解决方案或任何有意义的事情。

Option Explicit

Sub mainproject()

Dim IE As New SHDocVw.InternetExplorer
Dim HTMLdoc As MSHTML.IHTMLDocument
Dim objsw As ShellWindows
Dim x As New InternetExplorer

Set objsw = New ShellWindows

IE.Visible = True
IE.navigate "http://www.flashscore.com/basketball/usa/nba/"

Do While IE.readyState <> READYSTATE_COMPLETE
    Application.Wait Now + TimeValue("00:00:01")
Loop

'Debug.Print IE.LocationName, IE.LocationURL    
IE.document.getElementById("fs-summaryfixtures ").Children(0).Children(2).Children(1).Children(2).Click ""

For Each x In objsw
    If x.LocationName = "match-summary" Then
        Set IE = x
        Exit For
    End If
Next x
Debug.Print IE.LocationName, IE.LocationURL

End Sub

0 个答案:

没有答案