Добрый день! Буду очень благодарна, если подскажите как мне скопировать индекс почтовый в ексель. Никак не получается у меня.
Заранее спасибо!
Код
Sub Индекс()
Dim IE As Object
Dim N As Integer
Dim lLastRow As Variant
lLastRow = ThisWorkbook.Worksheets("Лист1").Cells(Rows.Count, 1).End(xlUp).Row
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "https://indexphone.ru"
While IE.Busy Or (IE.ReadyState <> 4): DoEvents: Wend
With IE.Document
For N = 2 To Cells(Rows.Count, 2).End(xlUp).Row
.GetElementsByName("search")(0).Value = Cells(N, 2).Value
SendKeys ("{Enter}")
Sheets("Лист1").Cells(N, 4).Value = IE.Document.getElementsByClassName("post-search-list-postalcode")(0).innerText
Application.Wait Time:=Now + TimeValue("0:00:10")
Next
End With
End Sub
Encoded = WorksheetFunction.EncodeURL("Россия, Еврейская Аобл, Ленинский р-н, ст Ленинск, ул Красноармейская,д.52")
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", "https://indexphone.ru/?search=" & Encoded, "False"
.SetRequestHeader "Content-Type", "text/html; charset=utf-8"
.Send
If .StatusText = "OK" Then
Response = .ResponseText
result = Split(Split(Response, "post-search-list-postalcode"">")(1), "</")(0)
Cells(1, 1) = result
End If
End With