Using Excel VBA, i have to scrape some data from this website.
Since the relevant website objects dont contain an id
, I cannot use HTML.Document.GetElementById
.
However, I noticed that the relevant information is always stored in a <div>
-section like the following:
<div style="padding:7px 12px">Basler Versicherung AG Özmen</div>
Question:
Is it possible to construct a RegExp
that, probably in a Loop, returns the contents inside <div style="padding:7px 12px">
and the next </div>
?
What I have so far is the complete InnerHtml
of the container, obviously I need to add some code to loop over the yet-to-be-constructed RegExp.
Private Function GetInnerHTML(url As String) As String
Dim i As Long
Dim Doc As Object
Dim objElement As Object
Dim objCollection As Object
On Error GoTo catch
'Internet Explorer Object is already assigned
With ie
.Navigate url
While .Busy
DoEvents
Wend
GetInnerHTML = .document.getelementbyId("cphContent_sectionCoreProperties").innerHTML
End With
Exit Function
catch:
GetInnerHTML = Err.Number & " " & Err.Description
End Function