Gen*_*alS 5 excel internet-explorer vba google-chrome
我知道如何使用 Excel VBA 和 IE,但我想知道是否可以使用 Google Chrome,因为我发现它比 IE 更快。
这是我具体的意思:
Set IE = CreateObject("InternetExplorer.Application")
Run Code Online (Sandbox Code Playgroud)
我可以用可以启动 Chrome 而不是 IE 的东西来代替它吗?
Google Chrome 不像 Internet Explorer 那样提供 Visual Basic 界面,因此您无法访问它的任何属性(例如Document)。您只需传递给可执行文件即可在特定地址启动 chrome。
例如:
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")
Run Code Online (Sandbox Code Playgroud)