Results 1 to 16 of 16

Selecting an option in DOM(HTML, Javascript)

Threaded View

  1. #1
    Registered User
    Join Date
    03-26-2014
    Location
    Norway
    MS-Off Ver
    Microsoft 365 MSO (Version 2403 Build 16.0.17425.20124) 64-bit
    Posts
    33

    Selecting an option in DOM(HTML, Javascript)

    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
    Last edited by Woulter; 05-06-2018 at 01:35 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 13
    Last Post: 03-30-2017, 06:45 AM
  2. HTML Select Multiple Values in Option Menu
    By San_K in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2015, 03:38 PM
  3. Select option in HTML drop down list
    By JohnsonJiang in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-15-2014, 03:28 PM
  4. Retrieve HTML <option> Values
    By danger_mouse in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2013, 04:20 PM
  5. Replies: 3
    Last Post: 02-02-2012, 12:18 PM
  6. Best option for Html
    By tj32 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-25-2008, 04:46 PM
  7. Navigating between option buttons is not selecting the option
    By Ramana in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-03-2005, 10:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1