• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Get HTML ids

Svmaxcel

Member
I have a intranet site, which has options to filter the data, I mean filtering date, department, Location, etc..
I want to use excel VBA to make the selection automatically and get the results.
When I right click on page, view source/inspect/F12 is not available.
So I thought if we can get all elements of the web page to figure out elements and proceed accordingly.
Can you please help with the code which will loop through all the elements and give me details.
 
I'd recommend asking whomever that manages site. If the intranet has API. If it does, it's far easier to interact with it using API rather than piloting IE.

If you just want to scrape all elements in a page...
Code:
Sub Demo()
Url = "https://www.sptv.ch/trainersuche/"
Dim ie As InternetExplorer
Set ie = New InternetExplorer
With ie
    .Visible = True
    .navigate Url
    While .Busy = True Or .readyState <> 4: DoEvents: Wend
    For Each x In .document.all
        Debug.Print x.tagName & "; " & x.innerText
    Next
End With
End Sub

You'd need to add reference to "MS InternetControls" & "MS HTML Object" libraries.
 
Back
Top