+ Reply to Thread
Results 1 to 3 of 3

HTML Select Multiple Values in Option Menu

  1. #1
    Registered User
    Join Date
    02-10-2015
    Location
    LA
    MS-Off Ver
    2010
    Posts
    2

    HTML Select Multiple Values in Option Menu

    Hello Excel Forum,

    This is my first post. I'm very new to HTML and have a little bit of experience with VBA. I am trying to navigate through a webpage so that I can eventually grab the table from the page.

    There is a multi-select dropdown menu on the page similar to the drop down menu in the following link.
    http://www.w3schools.com/tags/tryit....elect_multiple

    I need to be able to select multiple values in the drop-down menus and then submit the search. There are multiple drop-down menus to select from. One drop menu refers to "State" and the other to "Chain". Currently, I am able to select one drop-down menu item and submit the search which can be seen in the code below.

    Help is greatly appreciated! Thanks!


    VBA:
    Please Login or Register  to view this content.
    The HTML for the "State" ID can be seen below.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi, try this !


    PHP Code: 
    Sub Demo1()
        Const 
    WT 0.00002
        Dim oIE 
    As New InternetExplorer

        With oIE
            
    .Navigate "http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple"
            
    .Visible True
            
    While .Busy Or .ReadyState 4:  DoEvents:  Wend

            With 
    .Document.all("iframeResult").contentWindow.Document.body.Children(0)
                .
    all(1).Selected True
                
    .all(4).Selected True
                 Application
    .Wait Now WT
                
    .submit
            End With

            Application
    .Wait Now WT
            
    .Quit
        End With

        Set oIE 
    Nothing
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

    But to pilot IE is the worst way ! Intermediate way is the worksheet function Query from Web.
    Better way is a request like a webbrowser uses …

  3. #3
    Registered User
    Join Date
    02-10-2015
    Location
    LA
    MS-Off Ver
    2010
    Posts
    2

    Re: HTML Select Multiple Values in Option Menu

    Thank you for the reply. I solved it using a different method. You can see my final code below.

    Code:
    Please Login or Register  to view this content.

+ 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. 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
  2. Retrieve HTML <option> Values
    By danger_mouse in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2013, 04:20 PM
  3. Replies: 1
    Last Post: 07-10-2012, 05:16 AM
  4. Replies: 3
    Last Post: 02-02-2012, 12:18 PM
  5. [SOLVED] How can my macro select an option in a pull down menu?
    By Tim Richards in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2005, 07:06 PM

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