'Automating Edge IE Mode using VBA (without third-party software)
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://docs.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.
Solution 1:[1]
Unfortunately, it seems to be impossible to implement IE mode automation in the Edge browser using VBA so far. Even with SeleniumBasic, since there's no InternetExplorerOptions class or the like available, you cannot run the automation in the IE mode using VBA.
However, for now you don't have to worry about IE automation after the IE retirement. I tried to disable the IE11 browser following Response 1, and it turned out that VBA code still successfully launched IE browser window. You could expect your VBA code will work after the IE retirement.
For more information of IE retirement, please read this article:
I ran into issues with my application which utilizes IE through automation. Will this be fixed? (Updated: April 14, 2022)
As part of the IE 11 application retirement, certain COM automation scenarios were inadvertently broken. These IE COM objects have been restored to their original functionality as of the Windows 11 November 2021 “C” update and the Windows 10 March 2022 “B” update. The COM scenarios will also continue to work after the IE11 desktop application is disabled after June 15, 2022. If you continue to experience issues after taking the update, please contact App Assure for remediation assistance.
Solution 2:[2]
did you tried to execute the command with 2>&1?
"C:\Program Files\Hewlett Packard Enterprise\HPONCFG\hponcfg.exe" /f $File /l log.txt 2>&1 | out-null
2>&1 sends standard error to where ever standard output is being redirected which we will make Out-Null
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 | Yu Zhou |
| Solution 2 | Mahmoud Moawad |
