英文:
Changing browser from internet explorer to Microsoft edge in VBA script
问题
我有一段代码,在其中使用以下代码段在“Internet Explorer”中打开URL。
Dim IE As Object
Set IE = New InternetExplorerMedium
IE.Visible = True
IE.Navigate URL
现在我将其更改为以下内容
Dim IE As Object
Set IE = CreateObject("MSEdge.Application")
IE.Visible = True
IE.Navigate URL
然后我遇到了以下行的“运行时错误 '429' ActiveX组件无法创建对象”
Set IE = CreateObject("MSEdge.Application")
我尝试修复它,但陷入了死胡同,有人可以帮我修复这个错误吗?
我希望在Microsoft Edge中打开一个URL。
英文:
I have a code where I open an URL in "Internet Explore" using the following piece of code.
Dim IE As Object
Set IE = New InternetExplorerMedium
IE.Visible = True
IE.Navigate URL
now I changed it to as follows
Dim IE As Object
Set IE = CreateObject("MSEdge.Application")
IE.Visible = True
IE.Navigate URL
and I ran into "run time error '429' ActiveX component can't create a object" at the following line
Set IE = CreateObject("MSEdge.Application")
I tried to fix it but ran into a dead end, can someone help me to fix the error?
I am expecting to open an url in Microsoft edge
答案1
得分: 0
Microsoft Edge不支持COM自动化接口,因此无法使用传统的VBA方式自动化Microsoft Edge。要自动化Microsoft Edge,通常可以:
- 如果需要坚持使用VBA,可以使用SeleniumBasic。你可以参考此已接受的答案作为示例。
- 迁移到Selenium,如果你愿意转向其他语言,Selenium会不断更新以更好地支持现代浏览器。
英文:
Microsoft Edge does not support the COM automation interface so you won't be able to use the traditional VBA way to automate Microsoft Edge. To automate Microsoft Edge, normally you can:
- Use SeleniumBasic if you need to stick to VBA. You can refer to this accepted answer as an example.
- Move to Selenium if you are willing to switch to other languages, which keeps receiving updates to support modern browsers better.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论