获取运行时错误' -2147417848(80010108):自动化错误。调用的对象已与其客户端

时间:2015-11-18 17:52:43

标签: vba

获取以下代码的错误:

Sub test()
    Set ie = CreateObject("InternetExplorer.application")
    ie.Visible = True
    ie.navigate ("http://www.siteminder.com" & ActiveCell)
    Do
            If ie.readyState = 4 Then
                ie.Visible = True
                Exit Do
        Else
            DoEvents
        End If
    Loop

    ie.document.forms(0).all("User").Value = "me"
    ie.document.forms(0).all("Password").Value = "mypasssword"
    ie.document.forms(0).submit
End Sub

获取行错误:如果ie.readyState = 4那么

1 个答案:

答案 0 :(得分:0)

使用Internet Explorer,我更喜欢使用InternetExplorerMedium对象(过去我发现它更可靠):

Dim ie as InternetExplorer

Set ie = New InternetExplorerMedium

在任何情况下,等待浏览器可以是:

Do While ie.readystate <> 4 Or ie.Busy
    Application.Wait Now + TimeValue("00:00:01")
Loop