After the recent release of Windows 10, including the new browser - Microsoft Edge - would anyone simply know how to open Microsoft Edge browser via Excel VBA. I have tried searching the website without any luck.
This is the current basic Excel VBA coding I use to open the Internet Explorer:
Sub xyz()DimBrowserAsSHDocVw.InternetExplorer'Microsoft Internet Controls Dim HTMLdoc As MSHTML.HTMLDocument 'Microsoft HTML ObjectLibraryDim URL AsString URL ="http://www.bbc.co.uk/news"SetBrowser=NewInternetExplorerBrowser.Silent=TrueBrowser.navigate URL Browser.Visible=TrueDoLoopUntilBrowser.readyState = READYSTATE_COMPLETE SetHTMLdoc=Browser.document EndSub
This is a very straight forward piece of VBA coding to open the BBC website for example.
However, what is the new piece of coding to open Microsoft Edge?
The default browser for Windows 10 is Microsoft Edge, which is powered by our new rendering engine and is our path forward for the Web on Windows. Site developers should focus their testing on Microsoft Edge for new and existing experiences. Internet Explorer 11 will be included for some legacy scenarios and users will be have the option to choose it as the default browser, like with any other browser.
So existing code for IE should continue to work. Not tried it though.
As of Mon 10-Aug-2015, I have upgraded one PC from Win 7 Pro SP1 to Win 10 Pro and the code you supplied works fine. IE11 runs fine and shows the website. The IE11 download page confirms that I've already got it installed.
回答2:
I had a similar issue upon updating to Windows 10. Turns out 'Microsoft Internet Controls' and 'Microsoft HTML Object Library' had been "removed" from 'References'. Adding them resolved the problem and code worked fine without requiring any alterations. Don't know if this helps.
回答3:
This may not be an answer but it worked for me.
The Internet Explorer object will still open through VBA in Windows 10 using IE11. However, I had to ask Cortana to open IE11 first so it would sort out all of it's "first time use" pop-ups and what not. "Welcome to IE11" and "Let's get started" etc.
Once I got through all that and closed the browser. I re-ran my macro and the browser object came up fine and worked as normal. Hope this helps someone.
P.S. I'm using the CreateObject method of creating the browser window.
回答4:
how to open Microsoft Edge browser via Excel VBA
VBS/VBA uses the COM object model (ActiveX) to communicate with desktop processes and this feature will not be made available for Edge.
Fortunately newer cross-browser solutions (i.e. WebDriver) exist for automation and Edge adopts these new standards. Unfortunately, to use them, the techniques used will need to change.