title: Using Excel VBA to automate form filling in Internet Explorer
body: <p>I want to take values from an excel sheet and store them in an array. I then want to take the values from the array and use them to fill the web form. </p>
  
  <p>I have managed to store the values in the array and I have managed to get VBA to open Internet Explorer (IE)</p>
  
  <p>The code runs and no errors appear, but the text fields are not being populated, nor is the button being clicked</p>
  
  <p>(The debugger points to <code>[While .Busy]</code> as the error source, located in the <code>WITH</code> block)</p>
  
  <p>How do I go about filling the form (that has a total of 3 text boxes to fill)?</p>
  
  <p>There is also a drop down menu that I need to choose a value from, but I need to fill the text boxes prior to moving on to that part of the task.</p>
  
  <pre><code>Sub CONNECT_TO_IE()
  the_start:   
  Dim ie As Object
  Dim objElement As Object
  Dim objCollection As Object
  
  
  
  
  acct = GET_CLIENT_NAME()
  name = GET_CODE()
  
  Set ie = CreateObject("InternetExplorer.Application")
  
  
  ie.Visible = True
  ie.navigate ("&lt;&lt;my_website&gt;&gt;")
     ie.FullScreen = False
  
      On Error Resume Next
         Do
         DoEvents
         If Err.Number &lt;&gt; 0 Then
         ie.Quit
         Set ie = Nothing
         GoTo the_start:
         End If
         Loop Until ie.readystate = 4
  
  Application.Wait Now + TimeValue("00:00:10")
  
  ie.Document.getElementbyid("&lt;&lt;field_1&gt;&gt;").Value = "PPP"
  ie.Document.getElementbyid("&lt;&lt;field_2&gt;&gt;").Value = "PPP"
  ie.Document.getElementbyid("&lt;&lt;field_3&gt;&gt;").Click
  
  
  Set ie = Nothing
  End Sub
  </code></pre>