Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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

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