I have a list of numbers to put into a webpage. I want to enter the first value (cell A3) then enter A4 and so on. The VBA code I currently have logs a user onto the website, clicks initiate request, enters the first cell, presses submit, copy/paste the data back into excel, then returns to the first page. I want to make my code so that it does this process (clicks initiate, enters the number, presses submit,copy/paste,) again and again for however many numbers are in the column. How do I accomplish this?
I currently am able to log on , click the buttons, enter the first value (cell A3), click submit etc. When I return to the first page with this code, excel just stops. It doesnt enter the next number on the list.
Set IE = CreateObject("InternetExplorer.application")
IE.Visible = True
IE.Navigate ("http://URL.com")
With IE
Do
If IE.readystate = 4 Then
Exit Do
Else
DoEvents
End If
Loop
'Enters username and password , submits with continue button
With .document.forms("signning")
.UserName.Value = "userr"
.Password.Value = "password"
.document.forms(0).submit
End With
With .document
t = Timer
Do
On Error Resume Next
Set elems = .document.queryselectorall("input[value=InitiateRequest]")
On Error GoTo 0
If Timer - t > MAXWAIT_sec Then Exit Do
Loop While elems Is Nothing
If Not elems Is Nothing Then
elems.Item.Click
Else
End If
lastrow = ws.Cells(ws.rows.Count, "A").End(xlUp).Row
For i = 3 To lastrow
Set svalue1 = .getElementbyID("accountNumber")
svalue1.Value = ws.Cells(i, 1).Value
i = i + 1
For Each eInput In .getElementsbyTagName("input")
If eInput.getAttribute("value") = "Submit Request" Then
eInput.Click
Exit For
End If
Next eInput
IE.Visible = True
Then I copy and paste the info (this works correctly) and I protect the sheet. Then I navigate back to the start where I want to click initate request again. IE.Navigate ("https://URL.com")
Exit For
Next i
End With
End With
Aucun commentaire:
Enregistrer un commentaire