嘗試修改刮宏以單擊網頁上的按鈕。我在下面的代碼中收到錯誤91,並且不能爲我的生活找出原因。它不喜歡的對象是「dd」對象。我已經嘗試了迄今爲止在這裏看到的所有內容,所以任何新穎的想法都將非常感謝!VBA宏「對象變量或未設置塊變量」無法找出原因
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.EnableEvents = True
Dim wb1 As Workbook
Dim ws1 As Worksheet
Dim MyURL As String
Dim Rows As Long, links As Variant, IE As InternetExplorer, link As Variant
Dim i As Long
Dim sID As String
Dim rngLinks As Range, rngLink As Range
Dim filterRange As Range
Dim copyRange As Range
Set wb1 = ThisWorkbook
Set ws1 = wb1.Worksheets("Sheet1")
Set IE = New InternetExplorer
Rows = ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row
Set rngLinks = ws1.Range("E2:E" & Rows)
i = 2
With IE
.Visible = True
.navigate ("https://www.samplesite.com/account/update")
While .Busy Or .readyState <> 4: DoEvents: Wend
Application.Wait (Now() + TimeValue("00:00:006"))
Dim doc As Object
Set doc = IE.document
Dim classNameElem As Variant
Dim tagNameElem As Variant
Set classNameElem = doc.getElementsByClassName("thisisaclass")(0)
If (classNameElem <> Null) Then
Set tagNameElem = classNameElem.getElementsByTagName("input")(0)
End If
If (tagNameElem <> Null) Then
tagNameElem.Click
End If
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
ws1.Activate
Set rngLinks = Nothing
End Sub
嘗試從'Set dd'或Dim dd'設置'Set'作爲'Object'。 – Bathsheba
感謝您的提示,我已經嘗試了兩種修復方法。我也嘗試調暗爲一個字符串。 –
該行末尾的「Click」看起來很奇怪。看起來像一個不返回值的函數。 – Bathsheba