我需要根据我正在编写宏的excel书中的值从webform下拉列表中选择一个值.到目前为止,我已经能够导航到该网站并使用以下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
Run Code Online (Sandbox Code Playgroud)
接下来,我需要根据我正在尝试编写宏的工作簿中的预定义值(单元格引用)单击"Preparer","Approver"或"Reviewer".下面是我认为我需要在我的宏中引用以执行所描述的操作的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>
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
最好,
格兰特