title: Automation error when getting ReadyState of InternetExplorer object
body: <p>I get two different errors on the same line. Sometimes this one:</p>
  
  <blockquote>
    <p>Automation error: object invoked has disconnected from its clients </p>
  </blockquote>
  
  <p>and sometimes:</p>
  
  <blockquote>
    <p>the interface is unknown </p>
  </blockquote>
  
  <p>Minimal code to reproduce error:</p>
  
  <pre><code>Sub mcve()
      Dim ie As Object
      Dim www As String
      Set ie = New InternetExplorerMedium
      www = "http://www.stackoverflow.com"
      ie.navigate www
      ie.Visible = False
      While ie.ReadyState &lt;&gt; 4    ' &lt;~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs here
          DoEvents
      Wend
  End Sub
  </code></pre>
  
  <p>This requires a reference: Tools > References... > Microsoft Internet Controls</p>
  
  <p>The error occurs on <code>While ie.ReadyState &lt;&gt; 4</code> the second time.  How do I fix this?</p>