here is my full code as of now. everything is running fine up to the point we are speaking about.
Sub MCLogin()
Dim IE As Object
Dim IEdoc As Object
Dim oSelect As Object
Dim URL As String
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
Dim myYesterday As Date
Dim oInput1 As Object
Dim oInput2 As Object
Dim oSubmit As Object
MyURL = "*****************************************"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True
While MyBrowser.readyState <> 4: DoEvents: Wend
Set HTMLDoc = MyBrowser.document
HTMLDoc.all.txtLogonID.Value = "**********"
HTMLDoc.all.txtPswd.Value = "********"
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
Next
While MyBrowser.readyState <> 4: DoEvents: Wend
Application.wait Now + TimeSerial(0, 0, 2)
Set oSelect = MyBrowser.document.getElementById("CatID")
oSelect.Focus
oSelect.selectedIndex = 6
oSelect.FireEvent "onchange"
While MyBrowser.readyState <> 4: DoEvents: Wend
Application.wait Now + TimeSerial(0, 0, 2)
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Value = "Last" Then MyHTML_Element.Click: Exit For
Next
While MyBrowser.readyState <> 4: DoEvents: Wend
Set AllHyperLinks = HTMLDoc.getElementsByTagName("a")
For Each Hyper_link In AllHyperLinks
If Hyper_link.innerText = "New Jobs Remaining- Updated to match better 11/20/13" Then
Hyper_link.Click
Exit For
End If
Next
While IE.Busy And IE.readyState <> 4: DoEvents: Wend
While IE.Documet Is Nothing: DoEvents: Wend
With IEdoc
Set oInput1 = .getElementById("ex1-inputEl") ' Starting Date
Set oInput2 = .getElementById("ex2-inputEl") ' Endding Date
Set oSubmit = .getElementById("cmdSubmit") ' Get Report
End With
oInput1.Value = Format(Date - 1, "mm/dd/yyyy")
oInput2.Value = Format(Date - 1, "mm/dd/yyyy")
oSubmit.Click
End Sub
Bookmarks