html - 从 url 的下拉列表中选择一个选项
问题描述
我正在尝试使用 vba 函数 getElementById 选择下拉列表的第一个选项,但由于出现运行时错误而无法继续进行。以下是我通过互联网找到并对其进行了一些更改的代码。
Dim IE As Object
Dim oHtml As HTMLDocument
Dim oElement As HTMLUListElement
Dim dados As HTMLSelectElement
Dim i As Integer
Dim x As String
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False ' Keep this hidden.
IE.Navigate sSiteName
Set oHtml = New HTMLDocument
Set dados = oHtml.getElementById("ReportViewerControl_ctl04_ctl03_txtValue")
dados.Focus
dados.selectedIndex = 1
dados.FireEvent "onchange"
解决方案
推荐阅读
- rust - 是手动丢弃
> 使用 mem::uninitialized 定义的行为? - swift - ARAnchor 到底是什么?
- java - 如何创建 Reactor Netty 热流
- angular - 使用 Reactive Forms 将 formControlName 转发到 Angular 中的内部组件
- javascript - 创建 3 个不同的按钮,每次单击都会显示新图像
- c# - 在 IQueryable 中将可为空的 DateTime 转换为字符串时出现 500 错误
- r - R中西里尔符号的编码
- groovy - Groovy:插入文本的字符串列表丢失撇号
- kubernetes - 没有可用于服务“kubernetes-dashboard”的端点
- javascript - 如何以优雅的方式并使用 JavaScript 解决 UTC 问题,该问题在以“2018-10-25”格式实例化日期时减去一天?