Internet Explorer Macro Question

tycanis

New Member
Joined
Mar 14, 2011
Messages
12
I am trying to access drop down menus on a webpage through a macro. I have a macro where I am able open the correct website. I cannot directly open the website that the dropdown menu redirects you to because it does not have a different web address. Any ideas on how to access dropdowns in Internet Explorer through a macro? Thanks
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Can you post your current code and the URL for the page with the dropdowns on it?

It should be possible to write code to select from the dropdowns but the code could differ depending on how the page has been created/designed.
 
Upvote 0
Here is the code and what I think each part does. I am new to macros and self teaching myself so go easy if I have something wrong. I cannot post the webpage url because it is a company webpage and can only be accessed through internal computers. Hope this helps.

Sub DoBrowse1()
Dim ie As SHDocVw.InternetExplorer
Dim btnDropDown As MSHTML.HTMLInputElement
Dim ieDoc As MSHTML.HTMLDocument
Dim btnSubmit As MSHTML.HTMLInputElement
Set ie = New SHDocVw.InternetExplorer
'Opens webpage
ie.Navigate ""
'Wait until page is loaded
Do Until ie.readyState = READYSTATE_COMPLETE: Loop
ie.Visible = True
'Get Document object
Set ieDoc = ie.Document
'Try to select the dropdown. This does not work here.
Set btnDropDown = ie.all.DropDowns("Drop Down 1").ListIndex = 11
Set btnSubmit = ie.all.Item("Go")

End Sub
 
Upvote 0
Alright. I figured out a way around this. Now I need to try to make a webquery where the web address changes. What I have is a web address that increases incrementally with the date. I know what the address will be everyday but I do not know how to work this into a webquery in a macro. Any ideas? Thanks
 
Upvote 0
Sorry, know next to nothing about webqueries.

Why not start with the macro recorder? That's where I would start.

By the way it should be SelectedIndex, and there aren't any DropDown objects.

You were heading in the right direction though by getting a reference to the document.

That could be used to get references for the comboboxes, buttons etc, perhaps with something like GetElementByID.:)
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

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