'VBA Edge gives unspecific error on ReadyState

Ok so I have this script I did some time ago that was working perfectly fine 1-2 years ago on Internet Explorer however now I am on Windows 11 which has only Edge.

Every time I run this script, it hangs on Busy readystate for no reason. Has anything changed in the implementation? Because I am really confused.

Set IE = createobject("internetexplorer.application")
strURL = "http://www.website.com/"
IE.navigate strURL
IE.Visible = true
Do While (IE.Busy Or IE.ReadyState <> 4)    
    WScript.Sleep 100
Loop

Edit just to clarify: This script works just fine all the way to checking the ReadyState. It opens Edge, navigates to URL but then it throws an "Unspecified Error" on the line where it checks the ReadyState.

On Windows 10, it worked perfectly fine with IE.



Solution 1:[1]

The script presented in the question works correctly in Windows 11 build 22000.348 and above. According to this article, Microsoft "inadvertently broke" IE COM automation in Windows 11, but fixed it via an update released in November 2021. As per that same article: "IE COM objects have been restored to their original functionality and will continue to work after the IE11 desktop application is disabled".

Contrary to popular belief, Internet Explorer is still included in Windows 11 and is fully functional for any scripts that depend on it. All that has changed is that IE is not available as a default browser and running iexplore.exe in the usual ways, such as double-clicking, redirects to Edge. The following three line script will continue to launch IE in Windows 11 (and Windows 10 after June 15, 2022):

Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.Navigate "duckduckgo.com" 'put your URL of choice here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1