第一次提问,如果我错过任何明显的事情,请原谅我。搜索高低,但无法解决我的问题......
在运行下面的代码15行之后,IE崩溃时出现以下错误: Like this
我尝试减慢脚本速度,如下所示,尝试更改为InternetExplorerMedium,但仍遇到此问题。 我没有尝试过更改为xmlHttp调用Internet Explorer的方式,因为我并不想重写上面的所有内容。
此代码的目的是刮取Facebook的评论评分(慢慢地)。 感谢。
Private Sub CommandButton1_Click()
'Import Review
Dim appIE As Object
Set appIE = New InternetExplorerMedium
'Set appIE = CreateObject("internetexplorer.application")
lastRow = Range("B" & Rows.Count).End(xlUp).Row
benchmarkRating = 4.245 'review benchmark
lastData = Range("J" & Rows.Count).End(xlUp).Row
For reviewHandle = lastData + 1 To lastRow
Dim brand As String: brand = ActiveSheet.Cells(reviewHandle, 2)
Dim homepage As String: homepage = "https://www.facebook.com/pg/"
With appIE
.navigate homepage & brand & "/reviews/"
.Visible = False
'For i = 0 To 4
' DoEvents
' Application.Wait (Now + TimeValue("0:00:01"))
'Next i
End With
Do While appIE.Busy
DoEvents
Loop
'Do Calculations.....
'Application.Wait (Now + TimeValue("0:00:" & Int((6 - 1 + 1) * Rnd + 1)))
Next reviewHandle
ActiveSheet.Cells(reviewHandle, 2) = "Report executed on " & Now
appIE.Quit
Set appIE = Nothing
Application.StatusBar = "Extract Complete"
End Sub