Sub Contacts()
On Error Resume Next
Dim i As Long
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
' Create InternetExplorer Object
Set IE = CreateObject("InternetExplorer.Application")
' You can uncoment Next line To see form results
IE.Visible = True
' Send the form data To URL As POST binary request
Strt = ThisWorkbook.Sheets("Data").Cells(ThisWorkbook.Sheets("Data").Rows.Count, "C").End(xlUp).Row
If Strt = 1 Then
Strt = 2
End If
For csk = Strt To ThisWorkbook.Sheets("Data").UsedRange.Rows.Count
IE.Navigate ThisWorkbook.Sheets("Data").Cells(csk, 2).Value
' Wait while IE loading...
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Application.Wait (Now + TimeValue("0:00:05"))
Set objCollection = IE.Document.getelementsbyclassname("napu")
i = 0
While i < objCollection.Length
ThisWorkbook.Sheets("Data").Cells(csk, 3).Value = objCollection(i).Children(0).innertext
ThisWorkbook.Sheets("Data").Cells(csk, 4).Value = objCollection(i).Children(1).innertext
ThisWorkbook.Sheets("Data").Cells(csk, 5).Value = objCollection(i).Children(2).innertext
ThisWorkbook.Sheets("Data").Cells(csk, 6).Value = objCollection(i).Children(3).innertext
GoTo Line27
i = i + 1
Wend
Line27:
Next csk
End Sub
Comments
Post a Comment