Herkese Merhaba,
Aşağıdaki kod ile A sütununa yazdığım TC lerin adresleri çekebilmekteyim.
İşlemi tek tek yapmaktadır.
Yapmak istediğim, örneğin A sütununa 50 tane TC yazdığımda bunları tek tek değil de 50 sekme açarak aynı anda hepsinin sorgusunu yapması ve karşısına adreslerini yazması.
Bunu nasıl yapabilirim.
Sub _Arama()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
Application.Wait Now + TimeValue("00:00:02")
IE.Navigate "https:/.........../Ortak/KpsAdresBilgisi.aspx"
Application.Wait Now + TimeValue("00:00:02")
IE.Width = 1500
IE.Height = 1000
IE.Visible = False
While IE.Busy
DoEvents
Wend
son = Cells(Rows.Count, "A").End(3).Row
For i = 2 To son
If Cells(i, "E") = "İŞLEM TAMAM" Then
GoTo 0
Else
IE.Document.getElementById("ctl04_ctlTCKimlikNo").Value = Cells(i, "A")
IE.Visible = False
While IE.Busy
DoEvents
Wend
Set TrackID = IE.Document.getElementById("ctl04_ctlDogumTarihi_textBox")
IE.Document.getElementById("ctl04_ctlDogumTarihi_textBox").Value = ""
IE.Visible = False
While IE.Busy
DoEvents
Wend
Set TrackID = IE.Document.getElementById("ctl04_ctlKpsAdresPageCommand_CommandItem_Search")
IE.Document.getElementById("ctl04_ctlKpsAdresPageCommand_CommandItem_Search").Click
IE.Visible = False
While IE.Busy
DoEvents
Wend
Application.Wait Now + TimeValue("00:00:02")
On Error Resume Next
Cells(i, 6) = IE.Document.getElementById("ctl04_ctlMessageBox_lblMessage").innerText
On Error Resume Next
IE.Document.getElementById("ctl04_ctlMessageBox_btnClose").Click
On Error GoTo 0
On Error Resume Next
Cells(i, "C") = IE.Document.getElementById("ctl04_ctlAdresBilgi").Value
Cells(i, "D") = IE.Document.getElementById("ctl04_ctlIlIlce").Value
Cells(i, "B") = IE.Document.getElementById("ctl04_ctlDogumTarihi_textBox").Value
On Error GoTo 0
IE.Visible = False
While IE.Busy
DoEvents
Wend
Cells(i, "E") = "İŞLEM TAMAM"
IE.Visible = False
While IE.Busy
DoEvents
Wend
0:
End If
Next
IE.Quit
MsgBox "İŞLEM TAMAMLANDI. İYİ ÇALIŞMALAR."
End Sub
Aşağıdaki kod ile A sütununa yazdığım TC lerin adresleri çekebilmekteyim.
İşlemi tek tek yapmaktadır.
Yapmak istediğim, örneğin A sütununa 50 tane TC yazdığımda bunları tek tek değil de 50 sekme açarak aynı anda hepsinin sorgusunu yapması ve karşısına adreslerini yazması.
Bunu nasıl yapabilirim.
Sub _Arama()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
Application.Wait Now + TimeValue("00:00:02")
IE.Navigate "https:/.........../Ortak/KpsAdresBilgisi.aspx"
Application.Wait Now + TimeValue("00:00:02")
IE.Width = 1500
IE.Height = 1000
IE.Visible = False
While IE.Busy
DoEvents
Wend
son = Cells(Rows.Count, "A").End(3).Row
For i = 2 To son
If Cells(i, "E") = "İŞLEM TAMAM" Then
GoTo 0
Else
IE.Document.getElementById("ctl04_ctlTCKimlikNo").Value = Cells(i, "A")
IE.Visible = False
While IE.Busy
DoEvents
Wend
Set TrackID = IE.Document.getElementById("ctl04_ctlDogumTarihi_textBox")
IE.Document.getElementById("ctl04_ctlDogumTarihi_textBox").Value = ""
IE.Visible = False
While IE.Busy
DoEvents
Wend
Set TrackID = IE.Document.getElementById("ctl04_ctlKpsAdresPageCommand_CommandItem_Search")
IE.Document.getElementById("ctl04_ctlKpsAdresPageCommand_CommandItem_Search").Click
IE.Visible = False
While IE.Busy
DoEvents
Wend
Application.Wait Now + TimeValue("00:00:02")
On Error Resume Next
Cells(i, 6) = IE.Document.getElementById("ctl04_ctlMessageBox_lblMessage").innerText
On Error Resume Next
IE.Document.getElementById("ctl04_ctlMessageBox_btnClose").Click
On Error GoTo 0
On Error Resume Next
Cells(i, "C") = IE.Document.getElementById("ctl04_ctlAdresBilgi").Value
Cells(i, "D") = IE.Document.getElementById("ctl04_ctlIlIlce").Value
Cells(i, "B") = IE.Document.getElementById("ctl04_ctlDogumTarihi_textBox").Value
On Error GoTo 0
IE.Visible = False
While IE.Busy
DoEvents
Wend
Cells(i, "E") = "İŞLEM TAMAM"
IE.Visible = False
While IE.Busy
DoEvents
Wend
0:
End If
Next
IE.Quit
MsgBox "İŞLEM TAMAMLANDI. İYİ ÇALIŞMALAR."
End Sub
