I have looked and tried so many different methods to just perform a simple selection.
Looking to set the dropdown to 2021. It defaults to 2022.
Looking to set the dropdown to 2021. It defaults to 2022.
VBA Code:
Sub Get_Info
Dim sBrowserHwnd
Dim sURL As String
Dim sURLLoc As String
Dim Element As Object ' HTMLButtonElement
Dim btnInput As Object ' MSHTML.HTMLInputElement
sURL = "https://public.hcad.org/records/Real.asp?search=acct"
Set Browser = CreateObject("InternetExplorer.Application")
Browser.Visible = True
Browser.navigate sURL ' navigate to page
WaitForBrowser Browser, 3
Set HTMLDoc = Browser.document
Set varSearchYear = HTMLDoc.getElementsByName("TaxYear")
For Each elem In varSearchYear.getElementsByTagName("option")
If elem.Value = "2021" Then
elem.Selected = True
Exit For
End If
Next elem
' Tried this one as well
'HTMLDoc.getElementsByTagName("select").Value = "2021"