网络抓取工具出现错误,可以在家工作但不能在办公室工作

时间:2019-05-09 00:03:08

标签: excel vba

我收到“运行时错误'-2147418113(8000ffff)

当我尝试在工作中运行以下脚本时,对象'IWebBrowser2'的方法'Navigate'失败”错误,但是在家里/在我的笔记本电脑上都很好用。

我尝试在Internet Explorer中添加XML参考等

Sub scraper()

        Dim site As String
        Dim lastRow As Long
        Dim ie

        With ActiveSheet
            lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
        End With

            Set ie = CreateObject("internetexplorer.application")
            ie.Visible = True

            ie.navigate site

            'idle while ie is busy




            For i = 2 To lastRow

                site = Range("A" & i).Value
                ie.navigate site

            Do
            Loop Until ie.readystate = 3
            Do
            Loop Until ie.readystate = 4


        msg = ie.document.Body.innerhtml
        If InStr(msg, "Summary") = 0 Then
            ActiveSheet.Range("B" & i).Value = "Not Found"
        Else
            ActiveSheet.Range("B" & i).Value = "Found"
       End If
jump:
            Next i
        Exit Sub
error:
    ActiveSheet.Range("B" & i).Value = "Unknown Error!"
Resume jump


End Sub

应该给我一个发现或未发现的值,而不是错误

0 个答案:

没有答案
相关问题