简体   繁体   中英

VBA Excel IE click button

How do I press this button with VBA Excel. It is a webpage that triggers a AJAX and then supplies a dropdown meny that I need to press in next. Just can not remember how I do this.

<input type="button" name="ctl00$MainContent$m_Access$grdUserAccess$ctl00$ctl02$ctl02$Filter_CustomerName" value=" " onclick="$find(&quot;ctl00_MainContent_m_Access_grdUserAccess&quot;)._showFilterMenu(&quot;ctl00_MainContent_m_Access_grdUserAccess_ctl00&quot;, &quot;CustomerName&quot;, event); return false;__doPostBack('ctl00$MainContent$m_Access$grdUserAccess$ctl00$ctl02$ctl02$Filter_CustomerName','')" id="ctl00_MainContent_m_Access_grdUserAccess_ctl00_ctl02_ctl02_Filter_CustomerName" title="Filter" class="rgFilter">

I have done it once but lost the code, because of a hard-crash. Right now I am at...

Dim form2 As Variant

Set form2 = ie.document.getelementsbyname("ctl00$MainContent$m_Access$grdUserAccess$ctl00$ctl02$ctl02$Filter_CustomerName")
form2.Click

But nothing happens.

Any tip will be very appreciated.

Set form2 = ie.document.getElementById( _ 
          "ctl00_MainContent_m_Access_grdUserAccess_ctl00_ctl02_ctl02_Filter_CustomerName")
form2.Click

或者,您可以执行set form2 = ie.document.getElementById(_“ ctl00_MainContent_m_Access_grdUserAccess_ctl00_ctl02_ctl02_Filter_CustomerName”)form2.FireEvent(“ OnClick”)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM