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.
<!-- 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 -->
Can anyone get me moving in the right direction on this project?
Thanks! John
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