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.
Tagging ".net" just because there's a lot of overlap with error messages and resolutions.
The simplest case which produces it:
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
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 <> readyStateComplete"
However, using just any old link it does work.
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
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.
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.
Any thoughts?