澄清需要避免在VBArecursion

closures应用程序后,我成功地从中检索数据,它recursion地打开,我不能closures它。 请澄清为什么发生这种情况。

Sub macro() Dim appIE As Object Dim objElement As Object Dim Y As Long Dim obj As Object Dim r As Long, c As Long, t As Long Dim sathish As String Dim objCollection As Object Dim eRow As Long ' Create InternetExplorer Object Set appIE = CreateObject("InternetExplorer.Application") With appIE appIE.Visible = False appIE.navigate "website" Do While appIE.Busy Or appIE.ReadyState <> 4 DoEvents Loop appIE.Visible = True appIE.document.getElementById("Username").Value = "" appIE.document.getElementById("Password").Value = "" appIE.document.getElementById("btnSubmit").Click Number = Range("A1", Range("A1").End(xlDown)).Rows.Count Number = 10 For Y = 1 To Number sathish = Cells(Y, 1).Value appIE.document.getElementById("__tab_tabFilter").Click appIE.document.getElementById("filter_ReferenceCode").Value = sathish appIE.document.getElementById("filter_btnSetFilter").Click 'Set IE = Nothing Set objCollection = appIE.document.getElementsByTagName("TABLE") For t = 10 To (objCollection.Length - 1) For r = 0 To (objCollection(t).Rows.Length - 1) eRow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row For c = 0 To (objCollection(t).Rows(r).Cells.Length - 1) ThisWorkbook.Worksheets(2).Cells(eRow, c + 1) = objCollection(t).Rows(r).Cells(c).innerText Next c Next r If t = objCollection.Length - 1 Then Cells(eRow + 1, 1) = "" End If Next t Next Y End With ' Set IE = Nothing End Sub 

我想知道…文档上的“点击”可以在新的浏览器窗口/选项卡中打开文档?