1
Sub navigateurl()
Dim number As Integer 
Dim URL As String 
Dim propertyname As Object
URL = "http://keystonemanagement.com/apartments/me"
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True 
IE.Navigate URL
Do While IE.ReadyState <> 4 
Doevents
Loop
Set propertyname = IE.document.getElementsByTagName("h4") 
number = propertyname.Length 
For i = 0 To number - 1
ThisComponent.Sheets(0).getCellbyPosition(i, 0) = propertyname(i).innerText 
ThisComponent.Sheets(0).getCellbyPosition(i,0) = propertyname(i).getElementsByTagName("a")(0).href
Next i
End Sub

当我执行代码时,这一步出现了错误:

设置属性名 = IE.document.getElementsByTagName("h4")

错误:

BASIC 运行时错误。未设置对象变量

请帮助我,如何从 libre-macro 中的网页中提取数据?

4

0 回答 0