Open Google Chrome from VBA/Excel Open Google Chrome from VBA/Excel google-chrome google-chrome

Open Google Chrome from VBA/Excel


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


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


I found an easier way to do it and it works perfectly even if you don't know the path where the chrome is located.

First of all, you have to paste this code in the top of the module.

Option ExplicitPrivate pWebAddress As StringPublic Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

After that you have to create this two modules:

Sub LoadExplorer()    LoadFile "Chrome.exe" ' Here you are executing the chrome. exeEnd SubSub LoadFile(FileName As String)    ShellExecute 0, "Open", FileName, "http://test.123", "", 1 ' You can change the URL.End Sub

With this you will be able (if you want) to set a variable for the url or just leave it like hardcode.

Ps: It works perfectly for others browsers just changing "Chrome.exe" to opera, bing, etc.