错误显示为“对象变量或未设置块变量”
变量'Sathish'应该具有这种类型的值“ABC21A”。请建议我如何声明这个变量。此外,此代码需要运行1000次才能获取数据。我没有权利从办公室外访问该工具。所以我无法提供链接。
这是Sathish,在运行下面的代码时,我在这个区域收到错误 (appIE.document.getElementById(“__ tab_tabFilter”)。单击appIE.document.getElementById(“filter_ReferenceCode”)。Value = sathish)
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 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
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