Option
Explicit
Sub
Immobilienscout24()
Dim
Starttime
As
Double
Dim
MinutesElapsed
As
String
Dim
ws
As
Worksheet
Dim
objHTTP
As
XMLHTTP60
Dim
i
As
Long
, e
As
Long
, o
As
Long
Dim
StartEnd
As
Range
Dim
url
As
String
Dim
Result
As
Object
, Title
As
Object
Dim
oHtml
As
New
MSHTML.HTMLDocument
Starttime = Timer
Set
ws = Tabelle1
Set
objHTTP =
New
XMLHTTP60
With
objHTTP
.Open
"GET"
, url
.Send
End
With
Do
While
objHTTP.readyState < 4
DoEvents
Loop
Set
oHtml =
New
MSHTML.HTMLDocument
oHtml.body.innerHTML = objHTTP.responseText
Dim
Result
As
Object
Set
Result = oHtml.getElementsByClassName(
"palm-hide margin-bottom-m"
)(0)
e = Int(Result.innerText) / 20
For
i = 1
To
e
For
o = 0
To
19
With
objHTTP
.Open
"GET"
, url
.Send
End
With
Do
While
objHTTP.readyState < 4
DoEvents
Loop
oHtml.body.innerHTML = objHTTP.responseText
Set
StartEnd = ws.Range(
"A"
& ws.Range(
"A99999"
).
End
(xlUp).Row)
Set
Title = oHtml.getElementsByClassName(
"result-list-entry__brand-title"
)(o)
ws.Range(
"C"
& StartEnd.Row + 1).Value = Title.innerText
Next
o
Next
i
Set
oHtml =
Nothing
Set
objHTTP =
Nothing
MinutesElapsed = Format((Timer - Starttime) / 86400,
"hh:mm:ss"
)
MsgBox
"This code ran successfully in "
& MinutesElapsed &
" minutes"
, vbInformation
End
Sub