Nvm, solved it myself...:-D...apart from some minor mistakes like there was no loop to actualy collect all the street (or neglecting diacritics), the main trick to get past whatever S* microsoft deployed was to use CreateObject("MSXML2.XMLHTTP") instead of any other option that I´ve posted above. With this u want to reference the Microsoft XML, v3.0.
for those more curious, here goes working code:
(btw. took exactly 44 seconds to collect 7.189 rows)
Sub Harvest()
Dim InternetWindow As MSXML2.XMLHTTP
Dim HTML_Code As String
Dim Start_of_Code As Long
Dim End_of_Code As Long
Dim The_URL As String
Dim Main_Web As String
Dim Sub_Web() As Variant
Dim District_Name() As Variant
Dim Cap As Long
Dim Street_Name As String
Dim Dist_Name As String
Dim Row_No As Long
Set InternetWindow = Nothing
ReDim Sub_Web(O To 99999)
ReDim District_Name(O To 99999)
Debug.Print Time
Application.ScreenUpdating = False
Set InternetWindow = CreateObject("MSXML2.XMLHTTP")
j = 1
For i = 1 To 7
If i = 1 Then
Main_Web = "http://www.praha.cz/mestske-casti-praha?q=%2Fmestske-casti-praha"
Else
Main_Web = "http://www.praha.cz/mestske-casti-praha/strana-" & i & "?q=%2Fmestske-casti-praha"
End If
InternetWindow.Open "GET", Main_Web, False
InternetWindow.Send
Do
DoEvents
Loop Until InternetWindow.ReadyState = READYSTATE_COMPLETE
HTML_Code = InternetWindow.responseText
Do
DoEvents
Start_of_Code = InStr(HTML_Code, "/mestske-casti-praha/cast-obce-praha")
If Start_of_Code > 0 Then
The_URL = Mid(HTML_Code, Start_of_Code, Len(HTML_Code))
HTML_Code = The_URL
Start_of_Code = InStr(HTML_Code, "Část obce Praha") + 18
End_of_Code = InStr(HTML_Code, "</a>") - (Start_of_Code)
District_Name(j) = Mid(HTML_Code, Start_of_Code, End_of_Code)
The_URL = "http://www.praha.cz" & Mid(HTML_Code, 1, InStr(HTML_Code, "contentpagetitle") - 10)
Sub_Web(j) = The_URL
HTML_Code = Mid(HTML_Code, InStr(HTML_Code, "</a>"), Len(HTML_Code))
j = j + 1
End If
Loop Until Start_of_Code = 0
Next i
Cap = j
For i = 1 To j
If Sub_Web(i) <> "" Then
InternetWindow.Open "GET", Sub_Web(i), False
InternetWindow.Send
Do
DoEvents
Loop Until InternetWindow.ReadyState = READYSTATE_COMPLETE
On Error GoTo skip1
HTML_Code = InternetWindow.responseText
Start_of_Code = InStr(HTML_Code, "Ulice:")
End_of_Code = Len(HTML_Code)
HTML_Code = Mid(HTML_Code, Start_of_Code, End_of_Code)
On Error GoTo 0
Do
DoEvents
Start_of_Code = InStr(HTML_Code, "contentpagetitle")
If Start_of_Code > 0 Then
HTML_Code = Mid(HTML_Code, Start_of_Code + 18, End_of_Code)
Street_Name = Mid(HTML_Code, 1, InStr(HTML_Code, "<") - 1)
Dist_Name = District_Name(i)
Else
Street_Name = ""
Dist_Name = ""
End If
Row_No = WorksheetFunction.CountA(Sheets(2).Columns(2)) + 1
Sheets(2).Cells(Row_No, 2).Value = Dist_Name
Sheets(2).Cells(Row_No, 3).Value = Street_Name
Loop Until Start_of_Code = 0
End If
skip1:
On Error GoTo 0
Next i
Application.ScreenUpdating = True
Debug.Print Time
End Sub
Bookmarks