使用VBA代码点击网页上的按钮

编程入门 行业动态 更新时间:2024-10-26 13:32:42
本文介绍了使用VBA代码点击网页上的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在编辑一个vba程序,并希望对vba进行编码,以单击网页中的按钮。该按钮的HTML是:

< input type =imagesrc =/ lihtml / test_button3.gifalign =leftalt =File_Certificate_Go/>

我想我必须设置一个变量getElementBy ???然后variable.click,但我不知道如何准确地获取元素(因为它没有一个名称或ID,我不能给它一个,因为它不是我的网页)。

任何帮助都非常感谢!

解决方案

可能是以下行的:

设置tags = wb.Document.GetElementsByTagname(Input) 对于每个tagx在标记中如果tagx.alt =File_Certificate_Gothen tagx 。Click End If Next

其中wb是WebBrowser控件。 / p>

I am editing a vba program and want to code the vba to click on a button in a webpage. The html for the button is:

<input type="image" src="/lihtml/test_button3.gif" align="left" alt="File_Certificate_Go"/>

I imagine I would have to set a variable to getElementBy??? and then variable.click, but I can't figure out how exactly to get the element (because it doesn't have a name or id, and I can't give it one because it is not my webpage).

Any help is greatly appreciated!

解决方案

Perhaps something on the lines of:

Set tags = wb.Document.GetElementsByTagname("Input") For Each tagx In tags If tagx.alt = "File_Certificate_Go" Then tagx.Click End If Next

Where wb is the WebBrowser control.

更多推荐

使用VBA代码点击网页上的按钮

本文发布于:2023-06-09 04:13:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/595015.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   代码   网页   VBA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!