title: VBA code to loop through link, click them and close browser
body: <p>I want my code to perform this set of steps:</p>
  <ol>
  <li>get the URL from a cell</li>
  <li>open the URL</li>
  <li>wait some seconds to let the page load</li>
  <li>click a button on the page to create a DB object</li>
  <li>wait some second to let the page load</li>
  <li>close the page</li>
  <li>update the status bar to show progress</li>
  </ol>
  <p>Opening and closing IE at every instance of the loop is needed to avoid clogging IE with too many tabs. In the sheet there might by up to 1000 URL's.</p>
  <p>This is the loop I have written</p>
  <pre><code>For i = 14 To 13 + Count
      'get the URL
      URL = Range(&quot;F&quot; &amp; i)
      'Open IE instance
      Set IE = CreateObject(&quot;InternetExplorer.Application&quot;)
      'navigate to the URL
      With IE
          .Visible = True
          .Navigate URL
      End With
      'wait that the page is loaded
      Application.Wait (Now() + TimeValue(&quot;0:00:4&quot;))
      'click on the create object button
      Set Tags = IE.Document.GetElementsByTagname(&quot;Input&quot;)
      For Each tagx In Tags
          If tagx.alt = &quot;Create object&quot; Then
              tagx.Click
          End If
      Next
      'wait the page to be loaded
      Application.Wait (Now() + TimeValue(&quot;0:00:10&quot;))
      'close the tab
      IE.Quit
      'update progess bar
      Application.StatusBar = &quot;Progress: &quot; &amp; i - 13 &amp; &quot; of &quot; &amp; Count &amp; &quot;: &quot; &amp; Format((i - 13) / Count, &quot;0%&quot;)
  Next i
  </code></pre>
  <p>when I check the code step by step I get this error</p>
  <p><a href="https://i.stack.imgur.com/i9Vuz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i9Vuz.png" alt="enter image description here" /></a></p>
  <p>on the <code>set Tags</code> line, and I have no clue how to fix it.</p>
  <p>I have tried recording a macro to see how VBA sees the action of clicking the button, but that action is not recorded at all.</p>