运行时错误'-2147467259(80004005)':对象'IWebBrowser2'的方法'忙'失败

时间:2016-07-10 14:38:54

标签: excel excel-vba web-scraping vba

运行以下代码时,运行时错误-2147467259 (80004005)': Method 'Busy' of object 'IWebBrowser2'失败:(我使用的是Internet Explorer 11和ms Excel 2013版)

 Sub Get_UPC()

    Dim ie As Object
    Dim a As String
    Dim ASIN As String

    Application.ScreenUpdating = False
    Sheets("Extract UPC COde").Select
    Columns("A:A").ClearContents
    ASIN = Range("U2").Value
    'changed by Shanti Oppenheimer 7/10/2016
    'Set ie = CreateObject("InternetExplorer.Application")
    Set ie = New InternetExplorerMedium
    ie.Navigate "http://asintoupc.com/"
    ie.Visible = True

    **Do While ie.Busy And Not ie.READYSTATE = 4**
        DoEvents
    Loop

    DoEvents
    On Error Resume Next
    ''ie.Document.all.Item("MainContent_txtASIN").Value = ASIN
    Application.Wait (Now + TimeValue("00:00:02"))
    ie.Document.all.Item("MainContent_txtASIN").Value = ASIN
    ie.Document.all.Item("ctl00$MainContent$btnSearch").Click
    Application.Wait (Now + TimeValue("00:00:02"))
    With ie
        Do While .READYSTATE <> 4: Loop
        a = .Document.body.innerText 'other values can replace innertext, look up help for other options
        .Quit
    End With
    Range("A1").Value = a
    Set ie = Nothing

    SplitText
    AddtoList

End Sub

0 个答案:

没有答案