I am new to VBA and I am able to get to a dropdown and select a value, but, I can't proceed from the value. It should open a subsequent dropdown with a little calendar. I will attach images of the script and the web page.
This is the code that I tried:
Option Explicit
Sub GetHogData()
Dim ie As New SHDocVw.InternetExplorer
Dim HTMLdoc As MSHTML.HTMLDocument
Dim HTMLTables As MSHTML.IHTMLElementCollection
Dim HTMLTable As MSHTML.IHTMLElement
Dim HTMLDiv As MSHTML.IHTMLElement
Dim TableSection As MSHTML.IHTMLElement
Dim TableRow As MSHTML.IHTMLElement
Dim TableCell As MSHTML.IHTMLElement
Dim RowText As String
Dim ieObj As InternetExplorer
Dim htmlEle As Object
Dim i As Integer
Dim List As Object
Dim url As String
Dim selectElement As HTMLSelectElement
Dim changeEvent As Object
ie.Visible = True
ie.navigate "MPR Data Mart"
Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy
Loop
Set HTMLdoc = ie.Document
ie.Document.querySelector("[href*='Daily Swine']").Click
Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy
Loop
ie.Document.querySelector("[href*='(LM_HG201) National Daily Direct Hog Prior Day - Slaughtered Swine']").Click
Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy
Loop
ie.Document.getElementsByName("op_report_date")(0).Value = "GREATER"
Set changeEvent = HTMLdoc.createEvent("HTMLEvents")
DoEvents
End Sub
This is the code that I tried:
Option Explicit
Sub GetHogData()
Dim ie As New SHDocVw.InternetExplorer
Dim HTMLdoc As MSHTML.HTMLDocument
Dim HTMLTables As MSHTML.IHTMLElementCollection
Dim HTMLTable As MSHTML.IHTMLElement
Dim HTMLDiv As MSHTML.IHTMLElement
Dim TableSection As MSHTML.IHTMLElement
Dim TableRow As MSHTML.IHTMLElement
Dim TableCell As MSHTML.IHTMLElement
Dim RowText As String
Dim ieObj As InternetExplorer
Dim htmlEle As Object
Dim i As Integer
Dim List As Object
Dim url As String
Dim selectElement As HTMLSelectElement
Dim changeEvent As Object
ie.Visible = True
ie.navigate "MPR Data Mart"
Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy
Loop
Set HTMLdoc = ie.Document
ie.Document.querySelector("[href*='Daily Swine']").Click
Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy
Loop
ie.Document.querySelector("[href*='(LM_HG201) National Daily Direct Hog Prior Day - Slaughtered Swine']").Click
Do While ie.readyState <> READYSTATE_COMPLETE Or ie.Busy
Loop
ie.Document.getElementsByName("op_report_date")(0).Value = "GREATER"
Set changeEvent = HTMLdoc.createEvent("HTMLEvents")
DoEvents
End Sub