+ Reply to Thread
Results 1 to 4 of 4

VBA Web page issue: After inputting drop down menu selection cannot submit selection

  1. #1
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    VBA Web page issue: After inputting drop down menu selection cannot submit selection

    Hi there,

    I'm interested in creating a macro for collecting historical results from http://www.bbc.co.uk/sport/football/results

    Now when I physically go to the page and select the item from the drop down menu (html is <select id="int-group-drop-down" name="filter">) I want. The 'Update' button becomes activated.

    However using the below code, it inputs "The Championship" (which is what I want from id="int-group-drop-down") into the drop down menu but the 'Update' button doesn't become activated.

    I use the following code, I've tried 'focus' and 'click' options and even tried jumping back and forth from other drop down menu but can't seem to get the 'Update' button active unless I physically click on "The Championship". I know what the code would be to click on 'Update' once it's active but it's getting it active that I'm struggling with.

    Just for a visual aid, when I say 'Update' button becoming active, it should turn green.

    I haven't seen a similar case before as usually the 'submit' button can be selected with or without data entry.

    Any help would be great, thanks.

    Sub Test()
    Dim IE As InternetExplorer
    Dim doc As HTMLDocument
    Dim objdd1 As HTMLSelectElement
    Dim objdd As HTMLSelectElement
    Dim strURL As String

    strURL = "http://www.bbc.co.uk/sport/football/results"

    Set IE = CreateObject("InternetExplorer.application")

    IE.Visible = True
    IE.Navigate strURL

    Do While IE.Busy: DoEvents: Loop
    Do While IE.ReadyState <> 4: DoEvents: Loop

    Set doc = IE.Document
    Set objdd1 = doc.getElementById("uk-group-drop-down")
    doc.getElementById("filter")(0).Focus
    objdd1.Value = "competition-118996115"
    ' Set objdd = doc.getElementById("uk-group-drop-down")
    ' doc.GetElementsByTagName("uk-group-drop-down")(0).Focus
    ' objdd.Value = "competition-118996115"

    ' IE.Quit

    End Sub

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Web page issue: After inputting drop down menu selection cannot submit selection

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-25-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: VBA Web page issue: After inputting drop down menu selection cannot submit selection

    Hi Alphafrog.

    Thanks a million for that. I hadn't used FireEvent "onchange" before It's perfect
    Last edited by Al_O_L; 07-31-2013 at 05:25 AM. Reason: Called the user Alpha Dog instead of Alphafrog

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA Web page issue: After inputting drop down menu selection cannot submit selection

    Quote Originally Posted by Al_O_L View Post
    Hi Alphafrog.

    Thanks a million for that. I hadn't used FireEvent "onchange" before It's perfect
    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 03-27-2013, 07:04 AM
  2. Replies: 3
    Last Post: 01-31-2013, 06:22 PM
  3. Drop down menu-how i can get detail after selection
    By adeelkhan007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2011, 09:43 AM
  4. Drop-Down Menu Selection
    By moncureww in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-28-2008, 01:15 PM
  5. Drop down menu/data selection
    By sagat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2007, 07:45 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