I'm needing to select a value from a webform dropdown based on the value in the excel book where I'm writing the macro. So far I've been able to navigate to the website and click the desired tab with the following vba code:
Sub FillInternetForm()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "website I'm navigating to"
ie.Visible = True
While ie.Busy
DoEvents 'wait until IE is done loading page.
Wend
Set AllHyperLinks = ie.Document.getElementsByTagName("A")
For Each Hyper_link In AllHyperLinks
If Hyper_link.innerText = "Reconciliations" Then
Hyper_link.Click
Exit For
End If
Next
Next, I'm needing to click either "Preparer", "Approver", or "Reviewer" based on a predefined value (cell reference) within the workbook where I'm attempting to write the macro. Below is the html coding that I believe I need to reference within my macro to perform the action described:
<td class="DashControlTableCellRight"><select name="ctl00$MainContent$ucDashboardPreparer$ucDashboardSettings$ctl00$ddlRoles" class="ControlDropDown" id="ctl00_MainContent_ucDashboardPreparer_ucDashboardSettings_ctl00_ddlRoles" onchange="OnRoleChanged(this);">
<option selected="selected" value="Preparer">Preparer</option>
<option value="Reviewer">Reviewer</option>
<option value="Approver">Approver</option>
</select></td>
Any help would be greatly appreciated.
Best,
Grant
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…