I have programmed VBA to interact with IE rather extensively and have started to do so again, but am coming across a weird phenomenon that I cannot seem to solve with all the research I've done.
As soon as I load the website, I lose all reference to the InternetExplorer Application and can no longer work with the object.
When I check for the site being fully loaded, I got a Run-Time Error 424 Object Required, or a Run-time error '-2147023179 (...)': Automation Error The interface is Unknown
If I move past this line (while seeing the site fully loaded) and run the Set doc ... line, I get Run-Time Error 462: The remote server machine does not exist or is unavailable.
I am using IE 11 and Excel 2010. I have VBAProject References to Microsoft Internet Controls and MicrosoftHTML Object Library, but the errors occur with late binding as well.
Sub LoginToFXAll()
Dim ieApp As InternetExplorer
Set ieApp = New InternetExplorer
With ieApp
.Visible = True
.Navigate "https://www.google.com/"
Do
DoEvents
Loop Until .ReadyState = READYSTATE_COMPLETE ''<- Run-Time Error 424 occurs here
Dim doc As HTMLDocument
Set doc = .Document '<- Run-Time Error 462 occurs here
doc.all("q").Value = "Scott"
End With
End Sub