Hi I am having problem while submitting form for search on this Website.
http://www.hcdistrictclerk.com/edocs/public/search.aspx
My code seems to work for filling in the form.
However after, it tries to click the search button, the forms seems to be cleaned and no result return.
When I delete that particular line :.all("ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$btnSearch").Click
and click the search button manually, everything seems to be fine.
Any one can help me?
My code:
Sub test()
Dim searchURL, entity, paintiff, defendent As String
Dim i, k As Integer
plaintiff = "ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$tabSearch$tabCivil$txtPlaintiff"
k = Sheet1.Range("a65536").End(xlUp).Row
Set IE = CreateObject("internetexplorer.application")
Web_Address = "http://www.hcdistrictclerk.com/edocs/public/search.aspx"
' Access the Webpage
IE.Navigate Web_Address
IE.Visible = True
Start:
' Wait while IE loading...
Do While IE.Busy
Application.Wait DateAdd("s", 5, Now)
Loop
For i = 1 To k
entity = Cells(i, 1)
With IE.document.forms(0)
.all(plaintiff).Value = entity
.Submit
.all("ctl00$ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$ContentPlaceHolder2$btnSearch").Click
'This line seems to reset the form before submitting for search
'So it gives me no result
'If I delete this line and click the search button manually, everything works fine
End With
Next i
End Sub
Bookmarks