title: IE Web Automation - How to auto select value from combo box using Excel VBA/XML Macro
body: <p>I'm a beginner in VBA and I've failed to select country name automatically in web Combo box or list box from my Excel spreadsheet. My code is entering country name only, but not selecting it. 
  How can I change this code so it can pick country name from my Excel spreadsheet and select the same in web combo box as a loop. Passport number, DOB and Nationality are correct on my code. If you'll use manually then you can find the work permit number which I need to capture in my spreadsheet. Chrome Inspect Element screenshot is attached herewith.</p>
  
  <p><img src="https://i.stack.imgur.com/j3UYB.png" alt="Screenshot"></p>
  
  <p>My code is as follows:</p>
  
  <pre><code>Sub MOL()
      Dim IE As New SHDocVw.InternetExplorer
      Dim Doc As MSHTML.HTMLDocument
      Dim Buttons As MSHTML.IHTMLElementCollection
      Dim Button As MSHTML.IHTMLElement
      Dim HTMLInput As MSHTML.IHTMLElement
      Dim Tags As MSHTML.IHTMLElement
      Dim HTMLTables As MSHTML.IHTMLElementCollection
      Dim HTMLTable As MSHTML.IHTMLElement
      Dim HTMLRow As MSHTML.IHTMLElement
      Dim HTMLCell As MSHTML.IHTMLElement
      Dim Alltext As IHTMLElementCollection
  
  Application.ScreenUpdating = False
  'Application.Calculation = xlCalculationManual
  'Application.EnableEvents = False
  
  On Error Resume Next
  
      IE.Visible = True
      IE.navigate "https://eservices.mol.gov.ae/SmartTasheel/Complain/IndexLogin?lang=en-gb"
  
  Do While IE.readyState &lt;&gt; READYSTATE_COMPLETE: Loop
  
  Set Doc = IE.document
  Set Buttons = Doc.getElementsByTagName("Button")
  Buttons(2).Click
  Do While IE.readyState &lt;&gt; READYSTATE_INTERACTIVE = 3: Loop
  Set HTMLInputs = Doc.getElementsByTagName("Input")
      HTMLInputs(46).Value = "somevalue"
      HTMLInputs(48).Value = "24/02/1990"
      HTMLInputs(47).Value = "India"
  Buttons(21).Click
  End Sub
  </code></pre>