Internet Explorer Drop Down Box

Dad_x6

Board Regular
Joined
Jan 15, 2013
Messages
89
I am trying to select from a dropdown in IE from Access VBA. You cannot right click on the dropdown and inspect element. I ended up using something on found online, and it worked for a while, but it has now stopped working. Here is what I was using...

Code:
IEWindow.Document.querySelector("div[id=pagecontents] div[class=container] div[id=resultOptions] form[name=resultOptions] select[id=selectResult]").Focus
IEWindow.Document.querySelector("div[id=pagecontents] div[class=container] div[id=resultOptions] form[name=resultOptions] select[id=selectResult]").selectedIndex = 4
IEWindow.Document.querySelector("div[id=pagecontents] div[class=container] div[id=resultOptions] form[name=resultOptions] select[id=selectResult]").dispatchEvent evt


If I remember correctly, the error that occured is that it could not find the object (presumably the IE control that is referenced).

I then found another way to find that dropdown, and it appears that it is a control called selectResult (see the HTML below).

HTML:
- Choose -Store these results in a new C_Merge these results with an ex_Replace an existing ChartList _Download In CSV Format

So... The problem is that I am having trouble connecting to the IE control (the dropdown box). Then, when I connect to it, I need to be able to select the csv option (which I'm assuming is option 4 if zero based).
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
My HTML got lost :(

Here it is again (without the HTML tags this time, and without the sideways carrots)...

select id="selectResult"
option selected="selected" value="none"- Choose -/option
option value="new"Store these results in a new C_/option
option value="merge"Merge these results with an ex_/option
option value="replace"Replace an existing ChartList _/option
option value="csv"Download In CSV Format/option
/select
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,130
Members
453,021
Latest member
Justyna P

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