【发布时间】:2015-01-07 02:54:49
【问题描述】:
我想使用 Internet Explorer 通过 VBA 在网页上按下按钮。 我对几个网页都这样做没有问题,但我不能对一个特定的网页这样做。
按钮的HTML代码是
<button type="submit" name="submitImportFile" id="submitImportFile" class="btn btn-default pull-right" >
<i class="process-icon-next"></i>
<span>Pasul următor</span>
</button>
如何使用 VBA 按下它?
我试过了
Set allhyperlinks = IE.Document.getelementsbytagname("button")
For Each hyper_link In allhyperlinks
If hyper_link.getattribute("name") = "submitImportFile" Then
hyper_link.Click
Exit For
End If
Next
...它不工作。 谢谢!
我发现当从另一台计算机上运行时,代码运行良好。 但是当我从桌面运行它时,我在行中收到错误“需要对象”
ie.Document.getElementById("import").Click
为什么会出错?我检查了 VBA 引用,它们在两台计算机上都是相同的。
【问题讨论】: