I believe I am close but am struggling finding and clicking the correct element on this website. I have gotten VBA to log in and move pages for me but this one is stumping me now. I am using
Below is the HTML selection when I inspect the button I want to click on:
[1]: https://i.stack.imgur.com/HIWEP.png
I have been attempting using a few methods but I feel like I should be able to get it using something like the following (I have a comment pointing out where this should be):
Sub Login()
Const Url$ = "examplewebsite.com"
Dim HTMLDoc As HTMLDocument
Dim oHTML_Element As IHTMLElement
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Navigate Url
.Visible = True
Do While ie.Busy Or ie.ReadyState < 4
DoEvents
Loop
Set HTMLDoc = ie.Document
Dim Login As Object
Dim Password As Object
Dim LoginButton As Object
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Name Like "txt_1*" Then Set Login = oHTML_Element
If oHTML_Element.Name Like "txt_2*" Then Set Password = oHTML_Element
If oHTML_Element.Name Like "btnLogin*" Then Set LoginButton = oHTML_Element
Next
Login.Value = ""
Password.Value = ""
LoginButton.Click
Do While ie.Busy Or ie.ReadyState < 4
DoEvents
Loop
Call HTMLDoc.parentWindow.execScript("LoadContent('Report1017','ReportsList/ReportList.aspx?ReportParam=1017')", "JavaScript")
Do While ie.Busy Or ie.ReadyState < 4
DoEvents
Loop
'This is where I am stumped but think something like this should work:
HTMLDoc.getElementById("dlReportList_ctl00_hdnReportId").Click
End With
End Sub