How to navigate data from webpage in libre-macro?

.

**Navigate data from web page coding in libre macro as follows:**
        Sub navigateurl()
        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 run this coding, came error as “BASIC runtime error.Object variable not set.”
How to execute this coding?

Can you please (a) enclose all your code in your question in Code tags: and (b) tell us on which line the error occurs.

Codings:
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

The error came in this step “Set propertyname = IE.document.getElementsByTagName(“h4”)”

Please try this variant macro

Option VBASupport 1

Sub navigateurl()
    URL = "http://keystonemanagement.com/apartments/me"
    
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Visible = True
    ie.Navigate URL
    
    Do While ie.ReadyState <> 4
        DoEvents
    Loop

	oSheet = ThisComponent.getSheets().getByIndex(0)
	
    doc = ie.document.body
    Elements = doc.getElementsByTagName("h4")
    I = 1
    For Each element In Elements
        For Each el In element.all
            oSheet.getCellByPosition(0, I).setString(element.innerText)
            oSheet.getCellByPosition(1, I).setString(el.href)
            I = I + 1
        Next el
    Next element
    ie.Quit
    Set ie = Nothing
End Sub

Try run this macro from this demo file

Update This version used only office tools, without IE - collectDataFromURL.ods

Hi,
here coding as “For Each element In Elements” step error came as “Inadmissible value or data type.
Data type mismatch.”
and also coding as “oSheet.getCellByPosition(0, I).setString(element.innerText)” error as “BASIC runtime error.
Property or method not found: innerText”

How to overcome this issues??

What version of the office and which operating system are you using? Perhaps this affects the result … Do you want to collect data from the page only? Perhaps there is an easier way (without using the Internet Explorer). I added the file to my answer - it works well for me. Try it.

Now I have used LibreOffice version Version: 5.4.0.3.
I want to collect data from web page only.

Windows 10?

My system is Windows 8

May you send coding for libre calc macro web page extracting without using Internet Explorer?

Right now I debug this version of macro (open URL as calc_HTML_WebQuery, enumerate non-empty cells, extract hyperlinks from each of them, filter links to appartaments - there are many other links - and create result table) - please be patient