I'm creating a post as I've been researching this topic and have found some contradicting answers surrounding the ability to automate Edge IE Mode with VBA without third-party applications (see solutions below).
I currently have an app that accomplishes the following in IE:
- Verifies whether or not an instance of IE is already open and navigated to a specific URL;
- Creates a new IE instance if the above isn't true;
- Scrapes data available from the HTML doc; and
- Clicks elements to navigate to other tabs and pages.
Leading up to the deprecation of IE, I'm unsure how to direct my code to specifically communicate with Edge IE mode instead of it attempting to create a brand new instance of Internet Explorer. Does anyone possibly have specific examples that I could reference?
Response 1: https://stackoverflow.com/a/71994505/9791828
In that thread, one of the responses indicates that this automation is possible.
As of 25th April 2022, you can now directly automate Edge IE Mode with VBA without any additional third party-software. The below guidance has been well tested by me and my colleagues after obtaining it from exchanging with our partnered Microsoft Support team.
What You Need to Do
Your Windows version needs to be at least 20H2. You can check your Windows version with this guide here.
Your Windows needs to have the following KBs installed: KB5011487. Or simply update your Windows and this should be automatically installed as well. You can check your Windows update history with this guide here.
Finally install the below registry keys on your Windows and restart:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main] "NotifyDisableIEOptions"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main\EnterpriseMode] "EnableGlobalWindowListInIEMode"=dword:00000001
Per the MS Support team, the above method should work until 2029. Official documentation on this might be coming soon I believe.
After the above steps, VBA shall be able to interact with Edge IE Mode as if it is an Internet Explorer window. Your current code that automates the InternetExplorer.Application object will work with Edge IE mode as well.
Response 2: https://learn.microsoft.com/en-us/answers/questions/829365/vba-automation-with-edge-ie-mode.html
One of the community experts stated that this isn't possible without Selenium and a driver.
If Selenium is not an option, I think you can't automate with Edge IE mode.
The only way to automate with Edge IE mode is using IEDriver. You can't do it with only VBA. You need to:
Define InternetExplorerOptions with additional properties that point to the Microsoft Edge browser.
Start an instance of InternetExplorerDriver and pass it InternetExplorerOptions. IEDriver launches Microsoft Edge and then loads your web content in IE mode.
For more information, you can refer to this doc.