Select from a drop down menu using VBA

Johnnyv015

New Member
Joined
Sep 8, 2014
Messages
11
Hello, I am trying to click on a specific option in a dropdown on an IE page and I am having trouble with the code for this. As of now this is the code I have to access the page.

Code:
 Dim HTMLDoc As HTMLDocument
 Dim MyBrowser As InternetExplorer
 Sub MCLogin()

  Dim MyHTML_Element As IHTMLElement
  Dim MyURL As String
  On Error GoTo Err_Clear
  MyURL = "***********"
  Set MyBrowser = New InternetExplorer
  MyBrowser.Silent = True
  MyBrowser.navigate MyURL
  MyBrowser.Visible = True
  Do
  DoEvents
  Loop Until MyBrowser.readyState = 4
  Set HTMLDoc = MyBrowser.document
  HTMLDoc.all.txtLogonID.Value = "*******"
  HTMLDoc.all.txtPswd.Value = "*********"
  For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
  If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
  Next
Err_Clear:
  If Err <> 0 Then
  Err.Clear
  Resume Next
  End If
  Resume Next

  
  End Sub

<!-- END TEMPLATE: bbcode_code -->Now I need to click on a drop down and select an option from a list(in the same window.) Here is the HTML for the Dropdown box. <!-- BEGIN TEMPLATE: bbcode_html -->

HTML:
 -Select- Business Review Close Daily Dashboard Close Quality Assurance Close Reporting Close Weekly Dashboard Closing Employee Lookup Job Counts Josh Analysis Multi-Property New Hire Online Reservation Phone THD Finance Tech Time Reports

Can anyone get me moving in the right direction on this project?

Thanks! John
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Johnnyv015

New Member
Joined
Sep 8, 2014
Messages
11
Any ideas? or any other information needed for an answer on this? Also I did notice when I copy and pasted the HTML it removed the quotes.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,086
Messages
5,857,280
Members
431,868
Latest member
servox

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
Top