title: Write in an HTML input field using Excel VBA
body: <p>I load an internet page and log in with <code>myusername</code> and <code>mypassword</code> using VBA. </p>
  
  <p>I would like to write a search-term in an input field of the webpage using VBA.</p>
  
  <p>Because there is no name and ID in the input field, I didn't succeed.</p>
  
  <p>Here is my code :</p>
  
  <pre><code>Sub MyLogin()
  
  Dim IE As InternetExplorer
  Set IE = CreateObject("InternetExplorer.Application")
  With IE
      .Visible = True
      .navigate "https://www.example.com"
  
      Do Until .readyState = 4
          DoEvents
      Loop
  
      .document.all.Item("username").Value = "myusername"
      .document.all.Item("password").Value = "mypassword"
      .document.forms(0).submit
  
  End With
  
  Do Until IE.readyState = 4
      DoEvents
  Loop
  
  Dim inputfield As HTMLInputElement
  For Each inputfield In IE.document.getElementsByTagName("input")
      If inputfield.Type = "text" Then inputfield.Value = "mysearch"
  Next
  
  Do Until IE.readyState = 4
      DoEvents
  Loop
  
  End Sub
  </code></pre>
  
  <p>The HTML field I want to fill:</p>
  
  <blockquote>
    <p>input class="input-inboxsearch form-control" type="text" value="" placeholder="Nom, email" maxlength="71"</p>
  </blockquote>
  
  <p>How can I set the value of the input field?</p>