title: how to click a button on webpage having class name using vba excel
body: <p>I am a rookie in VBA excel.
  There is a web page application in which
  i need to click a button, the source of which is</p>
  
  <pre><code>&lt;em class="x-btn-arow" unselectable="on"&gt;
  &lt;button class= x-btn-text" id="ext-gen7576" style=""   type="button"&gt;Actions&lt;/button&gt;
  
  Sub xx()
  Dim IE As Object
  Dim doc As HTMLDocument
  Dim l As IHTMLElement
  Dim lo As IHTMLElementCollection
  
  
  
  
  Set IE = CreateObject("InternetExplorer.Application")
  IE.Visible = True
  IE.Navigate "http://theapplicationlink"
  Do
  DoEvents
  Loop Until IE.ReadyState = 4
  
  
  
  Set doc = IE.Document
  Set lo = doc.getElementsByTagName("button")
  For Each l In lo
  If l.getAttribute("class") = "x-btn-text" Then
  l.click
  
  
  
  End If
  Next
  
  End Sub
  </code></pre>
  
  <p>it doesn't throw any error but it doesn't click the button. </p>
  
  <p>I cannot use ID as it keeps on changing each time i launch the application.
  Also the class and type is same for other buttons also.</p>
  
  <p>Forgive me for any technical errors
  Any help will be a huge favour here.</p>