HTML/VBA 单击事件未触发



这是我第一次在StackOverflow上发布问题。到目前为止,我已经能够通过VBA帮助论坛解决我的大部分问题。

我的问题很简单。我有一个自动数据拉取,我需要在其中导出数据。我过去在这方面取得了成功,但这次略有不同。

我尝试单击以生成导出的按钮的 HTML 是这样的:

  <a id="ReportViewer1_ctl01_ctl05_ctl01" 
    style="font-family: Verdana; font-size: 8pt; color: Gray; text-decoration: none; 
    cursor: default;" href="#" title="Export"
 onmouseout="TextLinkReportViewer1_ctl01_ctl05_ctl01.OnLinkNormal();"
 onmouseover="TextLinkReportViewer1_ctl01_ctl05_ctl01.OnLinkHover();" 
    onclick="if (document.getElementById('ReportViewer1_ctl01_ctl05_ctl00').selectedIndex == 0) return false; 
    if (!ClientToolbarReportViewer1_ctl01.HandleClientSideExport()) __doPostBack('ReportViewer1$ctl01$ctl05$ctl01','');return false;">Export</a>

我已经尝试了几种点击方法无济于事。

FireEvent 用于触发附加到任何元素的事件。

IE.document.getElementById("ReportViewer1_ctl01_ctl05_ctl01").click()
IE.document.getElementById("ReportViewer1_ctl01_ctl05_ctl01").FireEvent("onclick")
IE.document.getElementById("ReportViewer1_ctl01_ctl05_ctl01").click()

最新更新