Link to home
Start Free TrialLog in
Avatar of Guz Man
Guz Man

asked on

VBA: Web Scrapping, select item form List Box (DropDown List) by Name

Hi,

I'm trying to write a VBA script for Web Scrapping. I have to select an item form a ListBox (<select> tag in HTML) by its name.

Does anybody know how to do this?

I'm using this libraries:
1. Microsoft Internet Controls
2. HTML Object Library

Here you have some of the HTML code:
<select onchange="redirect(this.value);" name="select" id="select" style="width: 165px;">                
<option value="">Select a fund</option>                            
  <option value="/wps/myportal/mfs/non-us-advisor/products/meridian-funds/!ut/p/a1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOL9A40C_c09jAzcjYOdDYxcTPyNTUONDS1NjPW99KPSc_KTwEojHfOSjC3S9aOKUtNSi1KL9DLyi0v0I8rLy_Vy04r1kvNz9cOd9aOSKjx88gL1C7KjkiodFRUBZk22dA!!/dl5/d5/L2dJQSEvUUt3QS80SmlFL1o2X09RMlFPN0gyMEczU0MwMkQ0TzM1VTMxRk8y/?clearPortletSession=true&productId=480&shareId=33&viewMode=profile">                                                                  
      <!-- Do Nothing -->
      Absolute Return Fund                            
  </option>                      
        <option value="/wps/myportal/mfs/non-us-advisor/products/meridian-funds/!ut/p/a1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOL9A40C_c09jAzcjYOdDYxcTPyNTUONDS1NjPW99KPSc_KTwEojHfOSjC3S9aOKUtNSi1KL9DLyi0v0I8rLy_Vy04r1kvNz9cOd9aOSKjx88gL1C7KjkiodFRUBZk22dA!!/dl5/d5/L2dJQSEvUUt3QS80SmlFL1o2X09RMlFPN0gyMEczU0MwMkQ0TzM1VTMxRk8y/?clearPortletSession=true&productId=1466&shareId=33&viewMode=profile">
      <!-- Do Nothing -->
          Asia Pacific Ex-Japan Fund                            
  </option>                      
  <option value="/wps/myportal/mfs/non-us-advisor/products/meridian-funds/!ut/p/a1/04_Sj9CPykssy0xPLMnMz0vMAfGjzOL9A40C_c09jAzcjYOdDYxcTPyNTUONDS1NjPW99KPSc_KTwEojHfOSjC3S9aOKUtNSi1KL9DLyi0v0I8rLy_Vy04r1kvNz9cOd9aOSKjx88gL1C7KjkiodFRUBZk22dA!!/dl5/d5/L2dJQSEvUUt3QS80SmlFL1o2X09RMlFPN0gyMEczU0MwMkQ0TzM1VTMxRk8y/?clearPortletSession=true&productId=139597&shareId=33&viewMode=profile">
      <!-- Do Nothing -->    
      Blended Research European Equity Fund                
  </option>
</select>

Open in new window


I would like to select the item by Name, like: Absolute Return Fund, Asia Pacific Ex-Japan Fund, Blended Research European Equity Fund.

I have Option Explicit feature on, so I would appreciate if you specify the variable type as well.

I'm not an expert programmer, so anything will help.
Currently using Excel 2013 on Windows 10.
ASKER CERTIFIED SOLUTION
Avatar of Guz Man
Guz Man

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial