如何点击一个超链接(aspx页面)并保存
我尝试使用VBA单击的超链接如下所示:
a id=SearchResults_dgResults__ctl5_lnkbtnGetImage class=ItemStyle style="FONT-SIZE: 10pt; FONT-FAMILY: Arial" href="javascript:__doPostBack ('SearchResults$dgResults$_ctl5$lnkbtnGetImage','')">OH - House Bill of Lading /a
我已经从Excel表格1的单元格A1中获取了VBA代码来预填一个搜索框,单击搜索按钮并列出几个超链接。 我需要代码的第二部分点击标题为“OH - House Bill oflaading”的特定超链接(以上)。 我不知道它是否是因为这是一个aspx页面,但我尝试了使用其他代码但使用其他代码无济于事。
我到目前为止的代码是:
Public Sub IE_Search_and_Extract() Dim URL As String Dim IE As SHDocVw.InternetExplorer Dim htmlInput As MSHTML.HTMLInputElement Dim htmlColl As MSHTML.IHTMLElementCollection Dim HTMLdoc As HTMLDocument URL = "http://eglsiis12c.egl.corp/docvisionsearch/DocVisionSearch.aspx" Set IE = Get_IE_Window(URL) If IE Is Nothing Then Set IE = New SHDocVw.InternetExplorer End If With IE SetForegroundWindow .hwnd .Navigate URL .Visible = True While .Busy Or .ReadyState READYSTATE_COMPLETE DoEvents Wend .Document.getElementById("House1_txtHouseBillNum").Value = ActiveSheet.Cells(1, 1) .Document.getElementById("House1:btnHouseSearch").Click While .Busy Or .ReadyState READYSTATE_COMPLETE DoEvents Wend End With Call Uppercase End Sub Sub Uppercase() Dim IE As SHDocVw.InternetExplorer Set IE = IE.Document.getElementsByTagName("a") For Each IE In IE.Document.getElementsByTagName("a") If InStr(IE.innerText, "OH - Bill Lading of Lading") > 0 Then IE.Click Next End Sub
我试图做为2个独立的宏,因此调用大写。 有什么建议么?
链接地址: http://www.djcxy.com/p/38005.html上一篇: How to click on a hyperlink (aspx page) and save
下一篇: Show only selected table column after filter to new worksheets