drop down from IE object

Nine Zero

Well-known Member
Joined
Mar 10, 2016
Messages
625
Hello All,

I have a site i am going to and it contains 2 drop downs.

The selection of the first drop down triggers the options available in the second drop down to change.

for example:

drop down 1 could be
Blue
Red
Green

if blue is selected then drop down 2 will be
A
B
C

if green
D
E
F

and so on...

in my macro i have the following which works good

Code:
IE.Document.getElementsByTagName("select")("apisection").Value = "Orders"

the issue is that the second dropdown does not update the options available.

Any help?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Are there any events on the dropdown element? Use your browser's developer tools to find out.

I'm just guessing, but if there is a 'change' or 'onchange' event the code might be something like this:
Code:
    Dim changeEvent As Object
    Set changeEvent = IE.document.createEvent("MouseEvent")
    changeEvent.initEvent "change", True, False
    
    Dim dropDown As Object
    Set dropDown = IE.Document.getElementsByTagName("select")("apisection")
    
    dropDown.Value = "Orders"
    dropDown.dispatchEvent changeEvent
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top