我想編寫(xiě)代碼來(lái)單擊網(wǎng)站中的菜單。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...菜單在檢查菜單時(shí)我得到了 HTML 代碼VBA 沒(méi)有拋出任何錯(cuò)誤,但它沒(méi)有單擊菜單。運(yùn)行代碼后菜單如下所示我的 VBA 編輯器中有 Microsoft Internet 控件、Microsoft HTML 對(duì)象庫(kù)函數(shù)。
2 回答
- 2 回答
- 0 關(guān)注
- 162 瀏覽
添加回答
舉報(bào)
0/150
提交
取消