【发布时间】:2020-07-24 00:56:24
【问题描述】:
我想编写代码以单击网站中的菜单。
Sub SearchBot()
Dim ie As Object
Dim HTMLDoc As MSHTML.HTMLDocument
Dim ckt_No As String
ckt_No = Range("A2").Value
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ShowWindow ie.hwnd, SW_MAXIMIZE
ie.Navigate "http://gamit.web.att.com/gamitx/welcome.htm"
Do While ie.Busy = True Or ie.ReadyState <> 4: DoEvents: Loop
Set HTMLDoc = ie.Document
HTMLDoc.getElementById("yui-gen1").Focus
HTMLDoc.getElementById("yui-gen1").Click
Do While ie.Busy = True Or ie.ReadyState <> 4: DoEvents: Loop
Stop 'Press SHIFT + F9 and examine the window...
VBA 没有抛出任何错误,但是它没有点击菜单。
我的 VBA 编辑器中有 Microsoft Internet 控件、Microsoft HTML 对象库函数。
【问题讨论】:
标签: html excel vba web-scraping getelementbyid