Hi,
My below code works find with F8 key, but run key doesn't fill the web form. I tried so many time readyState function but still doesn't work. Could anyone knows whats the problem there.
Please watch this video to better understand the problem.
https://youtu.be/zxL5GlhG0iA
My below code works find with F8 key, but run key doesn't fill the web form. I tried so many time readyState function but still doesn't work. Could anyone knows whats the problem there.
Please watch this video to better understand the problem.
https://youtu.be/zxL5GlhG0iA
Code:
Sub Sprint()
Dim IE As Object
Dim objelement As Object
Dim c As Integer
Dim LastRow, i, j As Integer
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.navigate "https://website url here #"
'wait until first page loads
Do Until .readyState = 4
DoEvents
Loop
On Error Resume Next
Set sht = ThisWorkbook.Worksheets("Data")
LastRow = sht.Cells(sht.Rows.Count, "B").End(xlUp).Row
For j = 4 To LastRow
i = 112
If IE.document.all.Item(i).innertext = "ÔÍÑ (ãîñ. ïîøëèíà)" Then
IE.document.all.Item(i).Click
End If
IE.Visible = True
While IE.Busy
DoEvents 'wait until IE is done loading page.
Wend
'populate fields
With IE.document
'text boxes
.all("fio").Value = sht.Cells(j, 1)
.all("contact").Value = sht.Cells(j, 2)
.all("payer_address").Value = sht.Cells(j, 3)
.all("inn_from").Value = sht.Cells(j, 4) '"771562265931"
.all("inn").Value = sht.Cells(j, 5) '"7726062105"
.all("account").Value = sht.Cells(j, 6) '"45914000"
.all("purpose").Value = sht.Cells(j, 7)
.all("comment").Value = sht.Cells(j, 8) '"02.04.2016"
.all("sum").Value = sht.Cells(j, 10) '"1000"
.all("get_total_sum").Click
'.all("now_pay").Click
End With
Set IE = Nothing
Next j
End With
End Sub