我需要使用 VBA 从下拉菜单中选择一个特定选项。我怎样才能做到这一点?
https://clinicaltrials.gov/ct2/results?cond=&term=Medpace&cntry=&state=&city=&dist= 链接到我们试图从中提取的网页
IE.document.getElementsByName("down_count").click 我试过的代码
Full Module:
Private Sub Workbook_Open()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.Navigate ("https://clinicaltrials.gov/ct2/results?cond=&term=Medpace&cntry=&state=&city=&dist=")
While .Busy Or .readyState <> 4: DoEvents: Wend
End With
With IE.document
IE.Refresh
Set div = IE.document.getElementById("save-list-link")
div.FireEvent "onclick"
' Application.SendKeys "{TAB}", True
' Application.SendKeys "{TAB}", True
' Application.SendKeys "{SPACE}", True
' Application.SendKeys "{DOWN}", True
' Application.SendKeys "{ENTER}", True
' Application.SendKeys "{TAB}", True
' Application.SendKeys "{TAB}", True
' Application.SendKeys "{SPACE}", True
' Application.SendKeys "{DOWN}", True
' Application.SendKeys "{DOWN}", True
' Application.SendKeys "{DOWN}", True
' Application.SendKeys "{ENTER}", True
IE.document.getElementsByName("down_count").click
' For Each elt In IE.document.getElementById("number-of-studies")
' If InStr(elt.innerText, "Found") > 0 Then elt.click: Exit For
' Next elt
Set div4 = IE.document.getElementById("submit-download-list")
div4.click
End With
End Sub
希望研究数量转到所有找到(此数字更改)并选择文件格式为 CSV