Open Google Chrome from VBA/Excel

匿名 (未验证) 提交于 2019-12-03 01:29:01

问题:

I'm trying to open a Chrome browser from VBA. I understand Chrome does not support ActiveX settings so I'm curious if theres any work-arounds?

Dim ie As Object  Set ie = CreateObject("ChromeTab.ChromeFrame") ie.Navigate "google.ca"  ie.Visible = True 

回答1:

shell("C:\Users\USERNAME\AppData\Local\Google\Chrome\Application\Chrome.exe -url http:google.ca") 


回答2:

Worked here too:

Sub test544()    Dim chromePath As String    chromePath = """C:\Program Files\Google\Chrome\Application\chrome.exe"""    Shell (chromePath & " -url http:google.ca")  End Sub 


回答3:

You can use the following vba code and input them into standard module in excel. A list of websites can be entered and should be entered like this on cell A1 in Excel - www.stackoverflow.com

ActiveSheet.Cells(1,2).Value merely takes the number of website links that you have on cell B1 in Excel and will loop the code again and again based on number of website links you have placed on the sheet. Therefore Chrome will open up a new tab for each website link.

I hope this helps with the dynamic website you have got.

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 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!