html - 自动化 IE - VBA 问题,无法为 HTML 中的对象赋值
问题描述
我正在构建一个代码,以在我的 Intranet 服务器中将 VBA 中的例程自动化到 IE。当我尝试为 HTML 中的对象赋值时,vba 返回错误,我不知道我需要做什么。
我的 Intranet 服务器的 Html 代码行。
选项“值”仅在我手动输入值时出现:
INPUT onkeypress=soNumero() class=WidthFull maxLength=9 value=20000 name=numseqrs
当我打开空白 html 时,不会出现此选项..
INPUT onkeypress=soNumero() class=WidthFull maxLength=9 name=numseqrs
我的子程序:(这需要任何打开的 IE 窗口和控件)
Sub test()
Dim Shell_Application As Object
Dim Open_Window As Object
Dim IE As Object
Dim ca As Integer
Dim ele As Object
Set Shell_Application = CreateObject("Shell.Application")
For Each Open_Window In Shell_Application.Windows
If TypeName(Open_Window.document) = "HTMLDocument" Then
Set IE = Open_Window
Exit For
End If
Next
If IE Is Nothing Then
MsgBox "não achei"
Else
MsgBox "achei"
IE.document.getElementsbyClassName("numseqrs").value = "12345"
Set IE = Nothing
Set Shell_Application = Nothing
End Sub
当我尝试为 (12345) 赋值时"numseqrs"
,vba 返回错误Object does not support this property or method (Error 438)。
解决方案
推荐阅读
- selenium-webdriver - 访问与 app_host 不同的 URL 时,Capybara 不会完全重置
- android - onClick 在带有 DataBinding 的 MVVM 中不起作用
- python - 使用 tika Python 3 更快地阅读 pdf 文件
- pointers - 检查指针是否指向 Nil Slice
- python - 我怎样才能使def函数不显示两次
- stringtemplate - 如何防止额外的分隔符?
- sql-server - 加入计数表。每天需要每个 Cust_ID
- python - 在 django 中创建登录会话
- cookies - 我遇到了一个小的 IT 问题
- error-handling - Rust:从标准输入读取和映射行并处理不同的错误类型