Hi Solus,
If I now could get rid of the error when I come to the message box and it does not give the stupid error message, would be great + the evil IE save as dialog box
Here is the full code:
Sub Tester() 'PART 1
Dim LastRow As Long
Dim i As Integer
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
Dim ieDoc As Object
Dim ieObj As Object
Dim doc As HTMLDocument
Dim LoginForm As HTMLFormElement
Dim UserNameInputBox As HTMLInputElement
Dim PasswordInputBox As HTMLInputElement
Dim SignInButton As HTMLInputButtonElement
Dim HTMLelement As IHTMLElement
Dim qt As QueryTable
'The final row finder
FinalRow = Cells(Rows.Count, 10).End(xlUp).Row
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://" 'make sure you've logged into the page
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Set doc = IE.document
ActiveSheet.EnableCalculation = False
ActiveSheet.EnableCalculation = True
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Call IE.document.getElementById("username").SetAttribute("value", ActiveSheet.Range("b2").Value)
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Call IE.document.getElementById("password").SetAttribute("value", ActiveSheet.Range("a2").Value)
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
IE.document.getElementById("login").Click ' click the "search" button
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
IE.Navigate "http://my website"
Application.SendKeys "{TAB 2}", True
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
IE.Navigate "httpmy website&"
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Application.SendKeys "%{Left}", True
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Application.SendKeys "{TAB}", True
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
'>>>Here should come the loop<<<
FinalRow = Cells(Rows.Count, 10).End(xlUp).Row
For i = 2 To FinalRow ' it will start at row 2
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
'Call IE.document.getElementById("searchvalue").SetAttribute(i, "value")
Set doc = IE.document
'Get the only form on the page
Set toolsForm = doc.forms(0)
Set TextValue = toolsForm.elements("searchValue")
TextValue.Value = Cells(i, 10).Value
Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Set toolsForm = doc.forms(0)
Set SignInButton = toolsForm.elements("p_submit")
SignInButton.Click
MsgBox "Program Paused - Click OK to continue"
Next i
End Sub
Bookmarks