本文介绍了使用Chrome浏览器代替InternetExplorer.Application的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何使用Excel VBA和IE,但是我想知道是否可以使用Google Chrome,因为我发现它比IE快.
I know how to work with Excel VBA and IE, but I would like to know if it's possible to work with Google Chrome, since I find it faster than IE.
这就是我的意思:
Set IE = CreateObject("InternetExplorer.Application")
我可以用可以启动Chrome而不是IE的产品替代它吗?
Can I substitute this with something that will launch Chrome instead of IE?
推荐答案
Google Chrome浏览器不提供Internet Explorer提供的Visual Basic界面,因此您无法访问其任何属性(例如Document
).您只需传递给可执行文件即可在特定地址启动chrome.
Google Chrome does not provide a Visual Basic interface like Internet Explorer does, so you cannot access any of it's properties (e.g. Document
). You can launch chrome at a specific address just by passing to the executable.
例如:
Dim path As String = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
Dim executable As String = Path.Combine(path, "Google\\Chrome\\Application\\chrome.exe")
Process.Start(executable, "http://google.com")
这篇关于使用Chrome浏览器代替InternetExplorer.Application的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!