I want this to select an option other than 'Intraday' here, so that the URL in the 'Download' button starts with 'https://www.oslobors.no/ob/servlets/excel?type=history&columns=DATE', and not 'https://www.oslobors.no/ob/servlets/excel?type=history&columns=TIME'. I manage to get it to change to '1 week' and highlight it, but it doesn't actually change the selection so that the URL/chart is changed.
Public Sub OB()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Navigate "https://www.oslobors.no/ob_eng/markedsaktivitet/" _
& "#/details/STL.OSE/overview"
Do Until .readyState = 4: DoEvents: Loop
.Visible = True
End With
Call OB_Options(IE)
Set IE = Nothing
End Sub
Private Sub OB_Options(IE As Object)
Dim o As Object
Dim objCollection As Object
Set objCollection = IE.Document.getElementsByTagName("select")
Sleep 1000
For Each o In objCollection
If o.innerText Like "*Intraday 1 week 1 month 3 months*" Then
o.Value = "ONE_WEEK"
o.Click
o.Focus
o.FireEvent ("onchange")
o.FireEvent ("onclick")
Exit For
End If
Next o
Set objCollection = Nothing
End Sub
Bookmarks