简体   繁体   English

使用vba触发html锚href =“ javascript:void(0)”

[英]Use vba to trigger html anchor href=“javascript:void(0)”

This is my first post ever, so I hope not to bore you. 这是我有史以来的第一篇文章,所以希望您不要感到厌烦。

I am trying to use excel vba to access this website to get its data. 我正在尝试使用excel vba访问该网站以获取其数据。 I can get the data and I can change the dates, my problem is to change the times (eg 00:00 - 01:00 to 01:00 - 02:00). 我可以获取数据并且可以更改日期,我的问题是更改时间(例如00:00-01:00到01:00-02:00)。 I guess this is due to the 我想这是由于

<a href="javascript:void(0)" class="select2-choice" tabindex="-1">

behind the element. 在元素后面。 I just don't understand how to pass on the new time-span and how to trigger it to change the data. 我只是不了解如何传递新的时间跨度以及如何触发它来更改数据。 I already tried "FireEvents ("onclick")" on the anchor element without success. 我已经在锚元素上尝试了“ FireEvents(“ onclick”)“”,但没有成功。

I hope anybody can help me. 我希望有人能帮助我。 Thank you!! 谢谢!!

I already managed to change the time shown on the website element by using 我已经设法通过使用来更改网站元素上显示的时间

Set myData10 = IE.document.getElementsByTagName("span")
For Each inputElement In myData10
    If inputElement.ID = "select2-chosen-3" Then
        Set timepicker = inputElement
        timepicker.Focus
        timepicker.innerText = "02:00 - 03:00"
     End If
Next

but it seems like the new time is still not processed by the website. 但似乎新的时间仍未由网站处理。 The data on the website did not change to the new time. 网站上的数据未更改为新时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM