【问题标题】:Getting Run-time-error '-2147417848(80010108): Automation error. The object invoked has disconnected from its clients获取运行时错误'-2147417848(80010108):自动化错误。调用的对象已与其客户端断开连接
【发布时间】:2015-11-19 02:16:13
【问题描述】:

以下代码出错:

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

出现线路错误:If ie.readyState = 4 Then

【问题讨论】:

    标签: vba


    【解决方案1】:

    对于 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
    

    【讨论】:

    • Do While ie.readystate 4 Or ie.Busy Application.Wait Now + TimeValue("00:00:01") 对于那些给出接口的行循环是未知错误
    猜你喜欢
    • 2020-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-22
    • 2015-02-08
    相关资源
    最近更新 更多