2017-03-01 38 views
0

我试图连接到已经打开的IE窗口,但我在2号线的一些问题VBA对于已经连接opned IE窗口

Run time error 429 ActiveX Component can't create object

我还添加引用仍然不能够访问IE窗口。以下是代码。

Sub A() 
    Set objShell = CreateObject("Shell.Application") 
    IE_count = objShell.Windows.Count 
    For x = 0 To (IE_count - 1) 
    my_url = objShell.Windows(x).Document.Location 
    my_title = objShell.Windows(x).Document.Title 

    if my_title Like "Put your webpage title here" & "*" Then 
     Set ie = objShell.Windows(x) 
     Exit For 
    Else 
    End If 
    Next 
End Sub 

回答