我在使用下面的模块时遇到了麻烦,无论我在哪里看,即stackoverflow或其他地方,我都找不到解决方案。这是下面的代码:
Sub Test()
Dim IE As Object
Dim HTML As HTMLDocument
Sheets("Sheet1").Select
Range("D6:D1000") = "" ' erase previous data
Range("D6:D1000").Select
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.navigate "https://www.example.com"
'Set HTML = IE.document
Do Until .ReadyState = 4: DoEvents: Loop
compName = .document.getElementsByClassName("title")
compName = Replace(compName, Chr(10), Chr(13))
compName = Split(compName, Chr(13))
Range("D6").Resize(UBound(compName)) = Application.Transpose(compName)
.Quit
End With
End Sub
我在下一行收到运行时错误(“ 1004”应用程序定义的错误或对象定义的错误)
Range("D6").Resize(UBound(compName)) = Application.Transpose(compName)
我昨天有这条线,但是,今天我做了一些更改,现在这条线将无法运行。有人可以找到解决方案吗?