HTML / VBA点击事件不触发 [英] HTML/VBA Click event not firing

查看:506
本文介绍了HTML / VBA点击事件不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

This is my first time posting a question on StackOverflow. Up until now I have been able to resolve most of my questions via VBA help forums.

我的问题很简单。我有一个自动化的数据拉,我需要导出数据。过去我已经取得了成功,但这一点略有不同。

My issue is pretty simple. I have an automated data pull in which I need to export data. I have been successful with this in the past, but this one is slightly different.

我想要点击生成导出的按钮的HTML是这样的: / p>

The HTML for the button I am trying to click to generate the export is this:

  <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>

我尝试了几种方法点击无效。

I have tried several ways to click to no avail.

推荐答案

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

FireEvent is used to trigger the event attached to any element.

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

这篇关于HTML / VBA点击事件不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆