title: Excel VBA Web Scraping - Automation Error/Unspecified Error
body: <p>I'm trying to scrape and reformat some data in HTML. This is something I've done before with little problem but I'm running into an error.</p>
  
  <p>Tagging ".net" just because there's a lot of overlap with error messages and resolutions.</p>
  
  <p>The simplest case which produces it:</p>
  
  <pre><code>Sub main()
  
      Dim ie As InternetExplorer
      Dim htmlDoc As HTMLDocument
  
      Set ie = New InternetExplorer
  
      ie.Visible = True
  
      ' Unfortunately I'm not able to post the true link.
      ' But it is on github in case that's relevant.
  
      ie.navigate "https://pages.github.XXXX.net/XXXXX/XXX-XXXXXX/dev/XXXXXX/data/full/XXXXXX.html"
  
      Do While ie.Busy
          DoEvents
      Loop
  
      Set htmlDoc = ie.document
  
  End Sub
  </code></pre>
  
  <p>Which throws back "run-time error '-2147467259 (80004005)': Automation Error. Unspecified Error". This error occurs with this line "Set htmlDoc = ie.document". It was also happening when I had the wait condition as "Do while ie.busy or ie.readyState &lt;> readyStateComplete"</p>
  
  <p>However, using just any old link it does work.</p>
  
  <pre><code>Sub main()
  
      Dim ie As InternetExplorer
      Dim htmlDoc As HTMLDocument
  
      Set ie = New InternetExplorer
  
      ie.Visible = True
  
      ' Unfortunately I'm not able to post the true link.
      ' But it is on github in case that's relevant.
  
      ie.navigate "https://stackoverflow.com/"
  
      Do While ie.Busy
          DoEvents
      Loop
  
      Set htmlDoc = ie.document
  
  End Sub
  </code></pre>
  
  <p>When I pint out the readyState of the github instance it comes out '0', if that's informative. From other issues that I've read it seems that the problem is that the InternetExplorer object has been closed, but I'm not sure how that's happening.</p>
  
  <p>It's been recommended elsewhere for this issue to "clean" the project (cut out all the code, save, put it back) but this didn't work for me.</p>
  
  <p>Any thoughts?</p>