VBA-从IE下拉列表中选择值

时间:2019-12-02 10:34:01

标签: html vba internet-explorer web-scraping

尝试从带有VBA的IE上的下拉列表中选择Value="localecsv"选项。我不确定这个过程

enter image description here

Dim DropOptions As Object
Set DropOptions = objIE.document.getElementsByTagName("select")

For Each DropOptions In DropOptions
    If DropOptions.Value = "localecsv" Then
        DropOptions.Selected = True
        Exit For
    End If
Next

1 个答案:

答案 0 :(得分:0)

您可以使用下面的代码选择项目,然后在VBA中设置其值。

While objIE.ReadyState <> 4 Or ie.Busy: DoEvents: Wend

Dim ddXf As Object
Set ddXf = objIE.document.getElementById("xf")
ddXf.Value = "localecsv"