我试图从VBA打开Chrome浏览器。我知道Chrome不支持ActiveX设置,所以我很好奇如果有任何解决方法?从VBA/Excel打开Google Chrome
Dim ie As Object
Set ie = CreateObject("ChromeTab.ChromeFrame")
ie.Navigate "google.ca"
ie.Visible = True
我试图从VBA打开Chrome浏览器。我知道Chrome不支持ActiveX设置,所以我很好奇如果有任何解决方法?从VBA/Excel打开Google Chrome
Dim ie As Object
Set ie = CreateObject("ChromeTab.ChromeFrame")
ie.Navigate "google.ca"
ie.Visible = True
shell("C:\Users\USERNAME\AppData\Local\Google\Chrome\Application\Chrome.exe -url http:google.ca")
在这里工作过:
Sub test544()
Dim chromePath As String
chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""
Shell (chromePath & " -url http:google.ca")
End Sub
嗨@ahmad,如果它是一个动态网站会怎么样。我试过Shell(chromePath&“-url”&websiteaddress)。但它未能加载页面,但只加载谷歌的主页。 – useR 2015-01-27 08:35:57
您可以使用下面的VBA代码并将其输入到Excel中的标准模块。网站的列表可以输入,并应该在Excel中的单元格A1上这样输入 - www.stackoverflow.com
ActiveSheet.Cells(1,2).Value只需要您在单元格上的网站链接的数量B1在Excel中,并将根据您放置在工作表上的网站链接的数量一次又一次地循环代码。因此,Chrome会为每个网站链接打开一个新标签。
我希望这可以帮助您获得动态网站。
Sub multiplechrome()
Dim WebUrl As String
Dim i As Integer
For i = 1 To ActiveSheet.Cells(1, 2).Value
WebUrl = "http://" & Cells(i, 1).Value & """"
Shell ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe -url " & WebUrl)
Next
End Sub
Chrome可以成为标准浏览器吗?或者即使不是Chrome浏览器,您是否也需要打开Chrome?如果这是第一种情况,我猜你可以使用ShellExecute和URL之类的东西。 – Bart 2011-05-06 18:20:57