【发布时间】:2018-07-07 10:25:19
【问题描述】:
我需要根据我正在编写宏的 excel 书中的值从网络表单下拉列表中选择一个值。到目前为止,我已经能够导航到该网站并使用以下 vba 代码单击所需的选项卡:
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
接下来,我需要根据我尝试编写宏的工作簿中的预定义值(单元格引用)单击“准备者”、“批准者”或“审阅者”。下面是我认为我需要在宏中引用以执行所描述的操作的 html 编码:
<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>
任何帮助将不胜感激。
最好的,
授予
【问题讨论】: