【发布时间】:2026-01-02 16:15:02
【问题描述】:
在测试了不同的逻辑之后,我终于在Visual Basic for Applications中找到了触发以下属性的正确方法:
我想点击不保持不变的超链接,它会在每次尝试时显示不同的数字和超链接,下面是我的 VBA 代码:
Dim MyBrowser As InternetExplore
Dim MyHTML_Element As IHTMLElement
Dim myURL As String
Dim htmlInput As HTMLInputElement
Dim htmlColl As IHTMLElementCollection
Dim p As String
Dim link As Object
Dim I As Integer
Dim ie As SHDocVw.InternetExplorer
Dim doc As MSHTML.HTMLDocument
myURL = "url............."
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate myURL
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
If htmldoc.all.item(i).innerText = Range("K20").Value Then ' Range is equal to cell value "4000123486736"
htmldoc.all.item(i).Click <------- not woking both lines
另请参阅下面附加的对 IE 的检查:
【问题讨论】:
标签: html excel vba internet-explorer href