I have a basic VBA script that opens an InternetExplorer window so a user can authorize an OAuth2.0 connection. As part of this process, their browser is redirected to a callback address containing an access token. At present, I have the redirect URL set to http://localhost.
The script runs properly on Windows 10 with MS Access 2010 and Internet Explorer 11. However, in MS Access 2016 on another Win 10 PC, I receive the error -2147023179 Automation error The interface is unknown.
. I have confirmed that the redirect URL is correct and I have also hard coded a resolvable redirect URL which also works.
It appears that when InternetExplorer encounters an unresolvable URL it breaks the VBA connection to the IE instance. I'm looking for info that will help me circumvent this issue.
The code below is what I'm using:
Dim IE as InternetExplorer
' create IE instance
Set IE = CreateObject("InternetExplorer.Application")
Dim url as String: url = "www.some-website.com"
' show IE
IE.Visible = True
' navigate to OAuth authorize URl
IE.Navigate url
' wait for page to load
Do While IE.ReadyState = 4: DoEvents: Loop
' loop until callback url in address bar
' ERROR HAPPENS HERE
While InStr(1, IE.LocationURL, "http://localhost") <= 0
DoEvents
Wend