

Read More: How to Solve ‘Cannot Open the Specified File’ Error in Excel HyperlinkĢ. Then finally we combined these two variables to define the pathname argument of the Shell function in our VBA code. On the other hand, the 2nd variable holds the hyperlink ( ) of the Exceldemy website. Click on the address bar in the windows explorer to get the file location. We set Chrome’s executable file location in the first variable enclosed by two double quotations. In the above code, we defined two variables named chromeFIleLoaction and hyperlink as a string. Shell (chromeFileLocation & "-url " & hyperlink) Sub OpenHyperlinkInChrome()ĬhromeFileLocation = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe""" The following VBA code will open the Exceldemy website in a new tab in Chrome.Ĭode:Let’s copy and paste the VBA code into the visual basic editor and press F5 to run it. Task : In this example, we’ll open a hyperlink that is hardcoded in the VBA code in the Google Chrome browser. Open a Specific Hyperlink in Chrome with Excel VBA Now put your code inside the visual code editor and press F5 to run it.ġ.

Follow the steps to open the visual basic editor and write some code there. To open hyperlinks in the Chrome browser, we need to open and write VBA code in the visual basic editor.

This is the default file location for google Chrome to install on windows.įor the 2nd part, we can set the hyperlink hardcoded in the VBA code or get it as a cell value from the Excel worksheet. To get the file location of Chrome’s executable file, navigate to Drive C>Program Files (x86)>Google>Chrome>Application. The pathname argument consists of two parts– the 1st part holds the file location of Chrome’s executable program in the computer’s local storage and the 2nd part is for setting the hyperlink to open.

Here, we need to correctly configure the pathname of the hyperlink to open it in the Chrome browser. The Shell function is used to run an executable program using its file location from inside a VBA code. 3 Examples to Open Hyperlink in Chrome Using VBA in Excel
