如何使用vba单击搜索图标

时间:2017-06-02 10:08:08

标签: html vba internet-explorer

我想点击搜索图标,如下所示

icon

我尝试传递节点的id但没有成功。

以下是参考资料的HTML代码:

<a id="ctl00_CPHMainSearch_hypOpenProjectPopup" href="javascript:void(window.open('ProjectPopUp.aspx?ctl00_CPHMainSearch_AutoCompPR_SearchTxt=1&amp;ctl00_CPHMainSearch_AutoCompPR_IDValue=2&amp;ViewPopMode=ProjectSearch', 'ProjectPopUpaspx', 'scrollbars=yes,width=750,height=600,top=40,left=200,resizable=yes,status=yes,toolbar=no'));"><img style="border-width: 0px;" alt="" src="../Images/popup.gif"></a>

我尝试了一些代码,但没有运气: -

Dim ProjectSearch As Object

设置ProjectSearch = IE.document.getElementById(“ctl00_CPHMainSearch_hypOpenProjectPopup”) ProjectSearch.Click

但显示错误OBJECT必需

以下是代码的一部分: -

Sub code()
Dim IE As InternetExplorer
User_Name = Environ$("UserName")

Set IE = New InternetExplorerMedium
IE.Silent = True
IE.navigate "url"
IE.Visible = True

Dim ProjectSearch As Object
Set ProjectSearch = 
HtmlDoc.getElementById("ctl00_CPHMainSearch_hypOpenProjectPopup")
ProjectSearch.Click

End Sub

0 个答案:

没有答案