我已经从excel VBA链接了Internet Explorer,并且我想在循环中执行任务,但每当我在循环播放时,无论何时循环更改导航值,它都会显示“请求源正在使用”的错误&# 39;代码如下,请帮忙
提前感谢。
Dim ie As New InternetExplorer
Dim ws, ws1 As Worksheet
Dim lrow, lrow1, lrow2, lrow3 As Double
Dim lcol, lcoll As Integer
Dim a, b, c, d, e As Integer
Dim q, p, r, s, t As Integer
Dim iel As IHTMLElement
Dim iel2 As Object
Dim str As String
Set ws = ThisWorkbook.Sheets("MainFile")
Set ws1 = ThisWorkbook.Sheets("Details")
lrow = 0
On Error Resume Next
lrow = ws.Cells.Find("*", Range("A1"), xlFormulas, xlPart, xlByRows, xlPrevious, True).Row
On Error GoTo 0
If lrow > 1 Then
lcol = ws.Cells.Find("*", Range("A1"), xlFormulas, xlPart, xlByColumns, xlPrevious, True).Column
Set ie = New InternetExplorer
ie.Visible = True
ie.navigate "abcd.com"
Do
Loop Until ie.readyState = READYSTATE_COMPLETE
ie.document.getElementById("username").Value = ws1.Range("B1").Value
ie.document.getElementById("password").Value = ws1.Range("B2").Value
ie.document.forms(0).submit
Do
Loop Until ie.readyState = READYSTATE_COMPLETE
' start loop...................
For lrow1 = 2 To lrow
q = Application.WorksheetFunction.Match("Link", ws.Range("A1:" & Split(Cells(, lcol).Address, "$")(1) & "1"), 0)
str = ws.Range(Split(Cells(, q).Address, "$")(1) & lrow1).Value
Application.Wait (Now() + TimeValue("00:00:010"))
ie.navigate (str) 'error place
........