internet-explorer - VBA - IE GetElementByID 不工作

标签 internet-explorer vba vbe

在我认为正确的 ID 标签之后,我在搜索框中输入文本时遇到了一些麻烦。我从页面的源代码中获得了 ID。我以前在其他网站上做过这个。有人可以帮我吗?有没有另一种方法可以做到这一点?

Sub FileUpload()

Dim IEexp as Object
IEexp.visible = True
IEexp.Navigate ("www.example.com")

'this is where the problem
IEexp.Document.GetElementByID("step1_id_bean_newSupportingDoc_description").Value _ 
= "monthly update"

End Sub

我收到“调用的对象已与其客户端断开连接的自动化错误”

我从中提取 ID 的源代码:
<td class="Label">Description</td>
  <td class="Data"><input type="text" name="bean.newSupportingDoc.description" size="60" maxlength="250" value="" id="step1_id_bean_newSupportingDoc_description" class="NoBorder"/>
</td>

最佳答案

如果您使用 Set IEexp = New InternetExplorerMedium您不必更改 Internet 选项中的设置。它使用中等完整性应用程序设置自动实例化 IE 对象。

关于internet-explorer - VBA - IE GetElementByID 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15257179/

相关文章:

php - 为什么在并发打开的页面之间共享 PHP session 似乎在 FF 中有效,但在 IE 或 Chrome 中却无效?

css - Drupal 7 - Internet Explorer 7&8 忽略样式表

excel - VBA中如何使用不等于条件与通配符?

c# - 如何在 C# 中创建 Internet Explorer 侧边栏扩展?

excel - 如何从雅虎财经下载仅限 100 行的数据

vba - 如何使用 VBA 在给定文本条件下对表格进行排序?

vba - ThisWorkbook.ChangeFileAccess xlReadWrite 在 VBA 窗口中为工作簿创建多个 VBAProject

excel - 将 Visual Basic 编辑器的语言更改为英语

internet-explorer - 在没有用户交互的情况下将 SSL 证书添加到 IE