You can do something like this:
doc.getElementsByName("xs_r_gender").Item(1).Selected=True
or
doc.getElementById("xs_r_gender").selectedindex = 1
Where 1 is the male version (in both cases).
If a dropbox needs to trigger an event in order to know your choice, it is likely that it will be an "onchange" event. You can run it like this:
doc.getElementById("xs_r_gender").FireEvent("onchange")
If you ever want to choose an option based on the option text, you can use the function given by Lansman ( here ). Based on the same answer, if you want to call an option using the value property (instead of text, you can simply change the line If xComboName.Options(x).Text = xComboValue Then to If xComboName.Options(x).value = xComboValue Then ) .
This should cover all bases.
source share