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

When I executed the code, an error occured in this step:

Set propertyname = IE.document.getElementsByTagName("h4")

The error:

BASIC runtime error.Object variable not set

Please help me, how to extract data from the web page in libre-macro?

Jim K
  • 12,824
  • 2
  • 22
  • 51
  • With IE, there are security problems such as described at https://stackoverflow.com/questions/13869518/powershell-ie9-comobject-has-all-null-properties-after-navigating-to-webpage. A different way to accomplish this task is described at https://stackoverflow.com/a/25348260/5100564. – Jim K Aug 08 '17 at 17:08
  • Are you open to a python-UNO solution, or is Basic required? – Jim K Aug 08 '17 at 17:10
  • The basic requirement only. – Muthu Lakshmi Aug 09 '17 at 04:24
  • If you just need some content in the document you can also use the WEBSERVICE spreadsheet functions: https://help.libreoffice.org/Calc/WEBSERVICE – moggi Aug 09 '17 at 11:54

0 Answers0