Hello All,
I am struggling to select the value from a drop down list on web page by using VBA.
My code so far:
It seems that it picks the required value from the list, however does not select it in the drop-down...
Web page code is the following:
<label>From</label>
Choose a country
<select title="Choose a country to send from" name="fCountry" class="styled countryA "><option value="" selected="selected">Choose a country</option><option value="AFG" currency="[{" code":"afn","name":"afghan="" afghani"},{"code":"usd","name":"us="" dollar"}]"="">AFGHANISTAN</option><option value="ALB" currency="[{" code":"eur","name":"euro"}]"="">ALBANIA</option><option value="DZA" currency="[{" code":"dzd","name":"algerian="" dinar"}]"="">ALGERIA</option></select>
I am struggling to select the value from a drop down list on web page by using VBA.
My code so far:
Code:
Sub Select()
Dim objIE As InternetExplorer
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.navigate "https://www.moneygram.com/wps/portal/moneygramonline/home/estimator"
Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop
objIE.Document.forms("estimatorForm").getElementsByTagName("select")("fCountry").Value = "ALB"
objIE.Document.forms("estimatorForm").FireEvent ("onchange")
It seems that it picks the required value from the list, however does not select it in the drop-down...
Web page code is the following:
<label>From</label>
Choose a country
<select title="Choose a country to send from" name="fCountry" class="styled countryA "><option value="" selected="selected">Choose a country</option><option value="AFG" currency="[{" code":"afn","name":"afghan="" afghani"},{"code":"usd","name":"us="" dollar"}]"="">AFGHANISTAN</option><option value="ALB" currency="[{" code":"eur","name":"euro"}]"="">ALBANIA</option><option value="DZA" currency="[{" code":"dzd","name":"algerian="" dinar"}]"="">ALGERIA</option></select>